Skip to content

Commit 6f73585

Browse files
committed
FIX: fixed TO-ITIME formating if time value parts are less than 10 and or time contains miliseconds
1 parent 8bea939 commit 6f73585

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/mezz/mezz-date.r

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ to-itime: func [
1616
time [time! number! block! none!]
1717
][
1818
time: make time! time
19-
format/pad [2 #":" 2 #":" 2] reduce [
20-
time/hour time/minute round/down time/second
19+
format/pad [-2 #":" -2 #":" -2] reduce [
20+
time/hour time/minute to integer! time/second
2121
] #"0"
2222
]
2323

src/tests/units/date-test.r3

+5
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ Rebol [
109109
===end-group===
110110

111111
===start-group=== "Internet date"
112+
--test-- "TO-ITIME (Normalized time as used in TO-IDATE"
113+
--assert "09:04:05" = to-itime 9:4:5
114+
--assert "13:24:05" = to-itime 13:24:5.21
115+
112116
--test-- "TO-IDATE (Date to Internet date)"
113117
--assert "Thu, 28 Mar 2019 20:00:59 +0100" = to-idate 28-Mar-2019/20:00:59+1:00
114118
--assert "Thu, 28 Mar 2019 19:00:59 GMT" = to-idate/gmt 28-Mar-2019/20:00:59+1:00
@@ -121,6 +125,7 @@ Rebol [
121125
--assert 28-Mar-2019/0:00 = to-date to-binary "Thu, 28 Mar 2019 00:00:00 +0000"
122126
--assert 4-Apr-2019/19:41:46 = to-date "Thu, 04 Apr 2019 19:41:46 GMT"
123127

128+
124129
===end-group===
125130

126131
~~~end-file~~~

0 commit comments

Comments
 (0)