Comparing datetimes

This commit is contained in:
data-man 2018-04-01 00:41:38 +03:00
commit 759023e157
2 changed files with 21 additions and 1 deletions

View file

@ -367,4 +367,12 @@ suite "ttimes":
check $(dt - 1.months) == "2017-02-15T00:00:00+00:00"
dt = initDateTime(31, mMar, 2017, 00, 00, 00, utc())
# This happens due to monthday overflow. It's consistent with Phobos.
check $(dt - 1.months) == "2017-03-03T00:00:00+00:00"
check $(dt - 1.months) == "2017-03-03T00:00:00+00:00"
test "compare datetimes":
var dt1 = now()
var dt2 = dt1
check dt1 == dt2
check dt1 <= dt2
dt2 = dt2 + 1.seconds
check dt1 < dt2