File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,13 @@ describe('getSecondsUntilUTCMidnight', () => {
6363
6464 expect ( getSecondsUntilUTCMidnight ( ) ) . toBe ( 64800 ) ; // 18 hours = 64800 s
6565 } ) ;
66+
67+ it ( 'always returns an integer with sub-second precision input' , ( ) => {
68+ vi . setSystemTime ( new Date ( '2024-06-15T23:59:59.999Z' ) ) ;
69+
70+ expect ( Number . isInteger ( getSecondsUntilUTCMidnight ( ) ) ) . toBe ( true ) ;
71+ } ) ;
72+
6673} ) ;
6774
6875it ( 'returns positive seconds for every hour of day' , ( ) => {
@@ -145,6 +152,13 @@ describe('getSecondsUntilMidnightInTimezone', () => {
145152 }
146153 } ) ;
147154
155+ it ( 'always returns an integer with sub-second precision input' , ( ) => {
156+ // 2024-06-16T03:59:59.999Z is 23:59:59.999 in Etc/GMT+4 (UTC-4)
157+ vi . setSystemTime ( new Date ( '2024-06-16T03:59:59.999Z' ) ) ;
158+
159+ expect ( Number . isInteger ( getSecondsUntilMidnightInTimezone ( 'Etc/GMT+4' ) ) ) . toBe ( true ) ;
160+ } ) ;
161+
148162 it ( 'handles extreme timezone Etc/GMT-14 (UTC+14)' , ( ) => {
149163 // UTC 00:00 → local time 14:00 in UTC+14
150164 vi . setSystemTime ( new Date ( '2024-06-15T00:00:00.000Z' ) ) ;
You can’t perform that action at this time.
0 commit comments