Skip to content

Commit 82f14dc

Browse files
Remove section about dates
1 parent 4bcf048 commit 82f14dc

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

docs/blueprints.md

-37
Original file line numberDiff line numberDiff line change
@@ -116,43 +116,6 @@ protected function casts(): array
116116
}
117117
```
118118

119-
## Dates
120-
121-
As of Statamic 6, dates are stored in UTC, rather than your application's timezone.
122-
123-
While we recommend [using `UTC` as your application timezone](https://laravel.com/docs/master/eloquent-mutators#date-casting-and-timezones), if that's not possible, you should add accessors to your Eloquent models so Runway is always dealing with UTC Carbon instances.
124-
125-
```php
126-
// app/Models/Post.php
127-
128-
public function casts()
129-
{
130-
return [
131-
'publish_date' => 'datetime', // [tl! remove]
132-
];
133-
}
134-
135-
public function date(): Attribute
136-
{
137-
return Attribute::make(
138-
get: function ($value) {
139-
return Carbon::parse($value, 'UTC');
140-
},
141-
set: function ($value) {
142-
if (! $value instanceof Carbon) {
143-
$value = Carbon::parse($value, 'UTC');
144-
}
145-
146-
if ($value->tzName !== 'UTC') {
147-
$value = $value->utc();
148-
}
149-
150-
return $value->format('Y-m-d H:i:s');
151-
},
152-
);
153-
}
154-
```
155-
156119
## Computed Fields
157120

158121
Like Statamic Core, Runway supports the concept of Computed Fields. However, instead of the computed values being part of a callback in your `AppServiceProvider`, they're accessors on your Eloquent model.

0 commit comments

Comments
 (0)