@@ -32,13 +32,7 @@ const MIN_TIME_ZONE_OFFSET = -MAX_TIME_ZONE_OFFSET;
32
32
const SECONDS_PER_MINUTE = 60 ;
33
33
const MIN_ZONE_ID = 'Etc/GMT+12' ;
34
34
const MAX_ZONE_ID = 'Etc/GMT-14' ;
35
- const ZONE_IDS = [ 'Europe/Zaporozhye' , 'America/Argentina/Mendoza' , 'Etc/GMT-12' , 'Asia/Jayapura' , 'Pacific/Auckland' , 'America/Argentina/Rio_Gallegos' ,
36
- 'America/Tegucigalpa' , 'Europe/Skopje' , 'Africa/Lome' , 'America/Eirunepe' , 'Pacific/Port_Moresby' , 'America/Merida' , 'Asia/Qyzylorda' , 'Hongkong' ,
37
- 'America/Paramaribo' , 'Pacific/Wallis' , 'Antarctica/Mawson' , 'America/Metlakatla' , 'Indian/Reunion' , 'Asia/Chungking' , 'Canada/Central' , 'Etc/GMT-6' ,
38
- 'UCT' , 'America/Belem' , 'Europe/Belgrade' , 'Singapore' , 'Israel' , 'Europe/London' , 'America/Yellowknife' , 'Europe/Uzhgorod' , 'Etc/GMT+7' ,
39
- 'America/Indiana/Winamac' , 'Asia/Kuala_Lumpur' , 'America/Cuiaba' , 'Europe/Sofia' , 'Asia/Kuching' , 'Australia/Lord_Howe' , 'America/Porto_Acre' ,
40
- 'America/Indiana/Indianapolis' , 'Africa/Windhoek' , 'Atlantic/Cape_Verde' , 'Asia/Kuwait' , 'America/Barbados' , 'Egypt' , 'GB-Eire' , 'Antarctica/South_Pole' ,
41
- 'America/Kentucky/Louisville' , 'Asia/Yangon' , 'CET' , 'Etc/GMT+11' , 'Asia/Dubai' , 'Europe/Stockholm' ] ;
35
+ const ZONE_IDS = [ 'Europe/Zaporozhye' , 'Europe/London' , 'UTC' , 'Africa/Cairo' ] ;
42
36
43
37
describe ( 'temporal-types' , ( ) => {
44
38
@@ -434,18 +428,22 @@ describe('temporal-types', () => {
434
428
435
429
function randomDateTimeWithZoneOffset ( ) {
436
430
return new neo4j . DateTimeWithZoneOffset (
437
- randomLocalDateTime ( ) ,
431
+ randomDstSafeLocalDateTime ( ) ,
438
432
randomZoneOffsetSeconds ( )
439
433
) ;
440
434
}
441
435
442
436
function randomDateTimeWithZoneId ( ) {
443
437
return new neo4j . DateTimeWithZoneId (
444
- randomLocalDateTime ( ) ,
438
+ randomDstSafeLocalDateTime ( ) ,
445
439
randomZoneId ( )
446
440
) ;
447
441
}
448
442
443
+ function randomDstSafeLocalDateTime ( ) {
444
+ return new neo4j . LocalDateTime ( randomDate ( ) , randomDstSafeLocalTime ( ) ) ;
445
+ }
446
+
449
447
function randomLocalDateTime ( ) {
450
448
return new neo4j . LocalDateTime ( randomDate ( ) , randomLocalTime ( ) ) ;
451
449
}
@@ -474,6 +472,15 @@ describe('temporal-types', () => {
474
472
) ;
475
473
}
476
474
475
+ function randomDstSafeLocalTime ( ) {
476
+ return new neo4j . LocalTime (
477
+ randomInt ( 4 , 23 ) , // do not generate hours in range where DST adjustment happens
478
+ randomInt ( 0 , 59 ) ,
479
+ randomInt ( 0 , 59 ) ,
480
+ randomInt ( 0 , MAX_NANO_OF_SECOND )
481
+ ) ;
482
+ }
483
+
477
484
function randomZoneOffsetSeconds ( ) {
478
485
const randomOffsetWithSeconds = neo4j . int ( randomInt ( MIN_TIME_ZONE_OFFSET , MAX_TIME_ZONE_OFFSET ) ) ;
479
486
return randomOffsetWithSeconds . div ( SECONDS_PER_MINUTE ) . multiply ( SECONDS_PER_MINUTE ) ; // truncate seconds
0 commit comments