Skip to content

Commit 7b03791

Browse files
committed
add failing "24 hour and more then 0 time component" cases
1 parent 6511395 commit 7b03791

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/src/DateTime.purs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,15 @@ datetimeTest = describe "Data.Formatter.DateTime" do
5151
)
5252

5353
describe "hour 24" do
54+
it "24 hour and more then 0 time component" $ do
55+
let err = (Left "When hour is 24, other time component must be 0@1:24")
56+
shouldEqual (FDT.unformatDateTime "YYYY-DD-MM HH:mm:ss:SSS" "0000-01-01 24:00:00:001") err
57+
shouldEqual (FDT.unformatDateTime "YYYY-DD-MM HH:mm:ss:SSS" "0000-01-01 24:00:01:000") err
58+
shouldEqual (FDT.unformatDateTime "YYYY-DD-MM HH:mm:ss:SSS" "0000-01-01 24:01:00:000") err
59+
5460
it "+1" $ shouldEqual
55-
(FDT.unformatDateTime "YYYY-DD-MM HH:mm:ss" "0000-01-01 24:59:59" )
56-
(Right $ makeDateTime 0 1 2 0 59 59 0 )
61+
(FDT.unformatDateTime "YYYY-DD-MM HH:mm:ss:SSS" "0000-01-01 24:00:00:000")
62+
(Right $ makeDateTime 0 1 2 0 0 0 0 )
5763

5864
describe "hour {0,12} {am,pm}" do
5965
let format = "hh a"

0 commit comments

Comments
 (0)