diff --git a/basis/calendar/format/format-tests.factor b/basis/calendar/format/format-tests.factor index cb1ff0b60f..4fee482df5 100644 --- a/basis/calendar/format/format-tests.factor +++ b/basis/calendar/format/format-tests.factor @@ -83,3 +83,14 @@ IN: calendar.format.tests [ ] [ { 2008 2009 } [ year. ] each ] unit-test + +[ + T{ timestamp + { year 2013 } + { month 4 } + { day 23 } + { hour 13 } + { minute 50 } + { second 24 } + } +] [ "2013-04-23T13:50:24" rfc3339>timestamp ] unit-test diff --git a/basis/calendar/format/format.factor b/basis/calendar/format/format.factor index e2af02a3cc..e6e30136e7 100644 --- a/basis/calendar/format/format.factor +++ b/basis/calendar/format/format.factor @@ -146,13 +146,17 @@ M: timestamp year. ( timestamp -- ) { { CHAR: + [ 1 ] } { CHAR: - [ -1 ] } } case time* ; : read-rfc3339-gmt-offset ( ch -- dt ) - dup CHAR: Z = [ drop instant ] [ - [ - read-00 hours - read1 { { CHAR: : [ read-00 ] } { f [ 0 ] } } case minutes - time+ - ] dip signed-gmt-offset - ] if ; + { + { f [ instant ] } + { CHAR: Z [ instant ] } + [ + [ + read-00 hours + read1 { { CHAR: : [ read-00 ] } { f [ 0 ] } } case minutes + time+ + ] dip signed-gmt-offset + ] + } case ; : read-ymd ( -- y m d ) read-0000 "-" expect read-00 "-" expect read-00 ;