@@ -380,93 +380,43 @@ public function testThrowExceptionIfDaysIsInvalid()
380
380
));
381
381
}
382
382
383
- public function testSetDataWithDifferentNegativeUTCTimezoneDateTime ()
383
+ public function testSetDataWithNegativeTimezoneOffsetStringInput ()
384
384
{
385
385
$ form = $ this ->factory ->create ('date ' , null , array (
386
386
'format ' => \IntlDateFormatter::MEDIUM ,
387
- 'model_timezone ' => 'America/New_York ' ,
388
- 'view_timezone ' => 'Pacific/Tahiti ' ,
387
+ 'model_timezone ' => 'UTC ' ,
388
+ 'view_timezone ' => 'America/New_York ' ,
389
389
'input ' => 'string ' ,
390
390
'widget ' => 'single_text ' ,
391
391
));
392
392
393
393
$ form ->setData ('2010-06-02 ' );
394
394
395
+ // 2010-06-02 00:00:00 UTC
396
+ // 2010-06-01 20:00:00 UTC-4
395
397
$ this ->assertEquals ('01.06.2010 ' , $ form ->getViewData ());
396
398
}
397
399
398
- public function testSetDataWithDifferentTimezonesDateTime ()
400
+ public function testSetDataWithNegativeTimezoneOffsetDateTimeInput ()
399
401
{
400
402
$ form = $ this ->factory ->create ('date ' , null , array (
401
403
'format ' => \IntlDateFormatter::MEDIUM ,
402
- 'model_timezone ' => 'America/New_York ' ,
403
- 'view_timezone ' => 'Pacific/Tahiti ' ,
404
+ 'model_timezone ' => 'UTC ' ,
405
+ 'view_timezone ' => 'America/New_York ' ,
404
406
'input ' => 'datetime ' ,
405
407
'widget ' => 'single_text ' ,
406
408
));
407
409
408
- $ dateTime = new \DateTime ('2010-06-02 America/New_York ' );
410
+ $ dateTime = new \DateTime ('2010-06-02 UTC ' );
409
411
410
412
$ form ->setData ($ dateTime );
411
413
414
+ // 2010-06-02 00:00:00 UTC
415
+ // 2010-06-01 20:00:00 UTC-4
412
416
$ this ->assertDateTimeEquals ($ dateTime , $ form ->getData ());
413
417
$ this ->assertEquals ('01.06.2010 ' , $ form ->getViewData ());
414
418
}
415
419
416
- public function testSetDataWithDifferentPositiveUTCTimezoneDateTime ()
417
- {
418
- date_default_timezone_set ('Pacific/Tahiti ' );
419
-
420
- $ form = $ this ->factory ->create ('date ' , null , array (
421
- 'format ' => \IntlDateFormatter::MEDIUM ,
422
- 'input ' => 'datetime ' ,
423
- 'widget ' => 'single_text ' ,
424
- ));
425
-
426
- $ dateTime = new \DateTime ('2010-06-02 Australia/Melbourne ' );
427
-
428
- $ form ->setData ($ dateTime );
429
-
430
- $ this ->assertDateTimeEquals ($ dateTime , $ form ->getData ());
431
- $ this ->assertEquals ('02.06.2010 ' , $ form ->getViewData ());
432
- }
433
-
434
- public function testSetDataWithSamePositiveUTCTimezoneDateTime ()
435
- {
436
- date_default_timezone_set ('Australia/Melbourne ' );
437
-
438
- $ form = $ this ->factory ->create ('date ' , null , array (
439
- 'format ' => \IntlDateFormatter::MEDIUM ,
440
- 'input ' => 'datetime ' ,
441
- 'widget ' => 'single_text ' ,
442
- ));
443
-
444
- $ dateTime = new \DateTime ('2010-06-02 Australia/Melbourne ' );
445
-
446
- $ form ->setData ($ dateTime );
447
-
448
- $ this ->assertDateTimeEquals ($ dateTime , $ form ->getData ());
449
- $ this ->assertEquals ('02.06.2010 ' , $ form ->getViewData ());
450
- }
451
-
452
- public function testSetDataWithSameNegativeUTCTimezoneDateTime ()
453
- {
454
- date_default_timezone_set ('America/New_York ' );
455
-
456
- $ form = $ this ->factory ->create ('date ' , null , array (
457
- 'format ' => \IntlDateFormatter::MEDIUM ,
458
- 'input ' => 'datetime ' ,
459
- 'widget ' => 'single_text ' ,
460
- ));
461
-
462
- $ dateTime = new \DateTime ('2010-06-02 America/New_York ' );
463
-
464
- $ form ->setData ($ dateTime );
465
-
466
- $ this ->assertDateTimeEquals ($ dateTime , $ form ->getData ());
467
- $ this ->assertEquals ('02.06.2010 ' , $ form ->getViewData ());
468
- }
469
-
470
420
public function testYearsOption ()
471
421
{
472
422
$ form = $ this ->factory ->create ('date ' , null , array (
0 commit comments