summaryrefslogtreecommitdiff
path: root/lib/date
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-09-21 22:39:01 -0700
committerOri Bernstein <ori@eigenstate.org>2015-09-22 09:43:57 -0700
commitf2854813a1a6c4603480af0a23d62d60fff770a2 (patch)
treead780e0bdcedbf79e413fc44ee71996ea6550c16 /lib/date
parentf7228d204a9cbe40f7b6286ba8987ef65691bfbd (diff)
downloadmc-f2854813a1a6c4603480af0a23d62d60fff770a2.tar.gz
Test for leap year transitions.
Diffstat (limited to 'lib/date')
-rw-r--r--lib/date/date.myr1
-rw-r--r--lib/date/test/fmt.myr8
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/date/date.myr b/lib/date/date.myr
index 0b0ebdb..afdbe09 100644
--- a/lib/date/date.myr
+++ b/lib/date/date.myr
@@ -203,3 +203,4 @@ const recalc = {inst
tm += (3600*h + 60*m + s)*1_000_000 + us
-> tm
}
+
diff --git a/lib/date/test/fmt.myr b/lib/date/test/fmt.myr
index 369e32f..e0aa610 100644
--- a/lib/date/test/fmt.myr
+++ b/lib/date/test/fmt.myr
@@ -54,6 +54,14 @@ const main = {
d = date.subperiod(d, `date.Year 1)
eq("1969-1-01 00:00:00 +0000", std.bfmt(buf[:], "{D}", d))
+ d = date.addperiod(d, `date.Day 365)
+ eq("1970-1-01 00:00:00 +0000", std.bfmt(buf[:], "{D}", d))
+
+ d = date.addperiod(d, `date.Year 2)
+ eq("1972-1-01 00:00:00 +0000", std.bfmt(buf[:], "{D}", d))
+ d = date.addperiod(d, `date.Day 365)
+ eq("1972-12-31 00:00:00 +0000", std.bfmt(buf[:], "{D}", d))
+
d = date.mkinstant(12*3601*1_000_000, "")
for var i = 0; i < 50; i++
d = date.addperiod(d, `date.Day 1)