@@ -26,10 +26,8 @@ public function setUp(): void
2626
2727 #[Test]
2828 #[DataProvider('augmentProvider ' )]
29- public function it_augments (string $ displayTimezone , array $ config , string $ value , string $ expected )
29+ public function it_augments ($ config , $ value , $ expected )
3030 {
31- config ()->set ('statamic.system.display_timezone ' , $ displayTimezone );
32-
3331 $ augmented = $ this ->fieldtype ($ config )->augment ($ value );
3432
3533 $ this ->assertInstanceOf (Carbon::class, $ augmented );
@@ -40,52 +38,35 @@ public static function augmentProvider()
4038 {
4139 return [
4240 'date ' => [
43- 'UTC ' ,
4441 [],
4542 '2012-01-04 ' ,
4643 '2012 Jan 04 00:00:00 ' ,
4744 ],
4845 'date with custom format ' => [
49- 'UTC ' ,
5046 ['format ' => 'Y--m--d ' ],
5147 '2012--01--04 ' ,
5248 '2012 Jan 04 00:00:00 ' ,
5349 ],
54- 'date with display timezone ' => [
55- 'America/New_York ' ,
56- [],
57- '2012-01-04 ' ,
58- '2012 Jan 04 00:00:00 ' ,
59- ],
6050
6151 // The time and seconds configs are important, otherwise
62- // when parsing dates without times, the time would inherit from "now".
52+ // when when parsing dates without times, the time would inherit from "now".
6353 // We need to rely on the configs to know when or when not to reset the time.
6454
6555 'date with time ' => [
66- 'UTC ' ,
6756 ['time_enabled ' => true ],
6857 '2012-01-04 15:32 ' ,
6958 '2012 Jan 04 15:32:00 ' ,
7059 ],
7160 'date with time but seconds disabled ' => [
72- 'UTC ' ,
7361 ['time_enabled ' => true ],
7462 '2012-01-04 15:32:54 ' ,
7563 '2012 Jan 04 15:32:00 ' ,
7664 ],
7765 'date with time and seconds ' => [
78- 'UTC ' ,
7966 ['time_enabled ' => true , 'time_seconds_enabled ' => true ],
8067 '2012-01-04 15:32:54 ' ,
8168 '2012 Jan 04 15:32:54 ' ,
8269 ],
83- 'date with time and display timezone ' => [
84- 'America/New_York ' ,
85- ['time_enabled ' => true ],
86- '2012-01-04 15:32 ' ,
87- '2012 Jan 04 10:32:00 ' , // -5 hours
88- ],
8970 ];
9071 }
9172
@@ -108,21 +89,6 @@ public function it_augments_a_carbon_instance()
10889 $ this ->assertSame ($ instance , $ augmented );
10990 }
11091
111- #[Test]
112- public function it_augments_a_carbon_instance_using_display_timezone_config ()
113- {
114- // Could happen if you are using the date fieldtype to augment a manually provided value.
115-
116- config ()->set ('statamic.system.display_timezone ' , 'America/New_York ' ); // -5 hours
117-
118- $ instance = new Carbon ('2025-01-01 12:00:00 ' );
119- $ augmented = $ this ->fieldtype ()->augment ($ instance );
120-
121- $ this ->assertInstanceOf (Carbon::class, $ augmented );
122- $ this ->assertEquals ('America/New_York ' , $ augmented ->getTimezone ()->getName ());
123- $ this ->assertEquals (7 , $ instance ->hour ); // 12pm in UTC is 7am in New York
124- }
125-
12692 #[Test]
12793 public function it_augments_a_range ()
12894 {
0 commit comments