Skip to content

Commit 679d4e2

Browse files
committed
FIX: adding ZONE to DATE value without TIME
fixes: metaeducation/rebol-issues#2369
1 parent cc6aaee commit 679d4e2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/core/t-date.c

+1
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,7 @@
649649
else if (IS_DATE(val)) tz = VAL_ZONE(val);
650650
else tz = n * (60 / ZONE_MINS);
651651
if (tz > MAX_ZONE || tz < -MAX_ZONE) return PE_BAD_RANGE;
652+
if (secs == NO_TIME) secs = 0;
652653
break;
653654
case 5:
654655
// date

src/tests/units/date-test.r3

+10-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,16 @@ Rebol [
8080
--assert 28-Oct-2009/17:09:38 = d/utc
8181
--assert 10 = d/hour
8282

83+
--test-- "issue 2369"
84+
;@@ https://github.com/rebol/rebol-issues/issues/2369
85+
d: 28-Mar-2019
86+
--assert not error? try [d/zone: 2]
87+
--assert "28-Mar-2019/0:00+2:00" = mold d
88+
d: 28-Oct-2009/10:09:38-7:00
89+
--assert not error? try [d/zone: 2]
90+
--assert "28-Oct-2009/10:09:38+2:00" = mold d
91+
8392
===end-group===
8493

85-
94+
8695
~~~end-file~~~

0 commit comments

Comments
 (0)