Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Latest commit

 

History

History
52 lines (34 loc) · 1.14 KB

README.md

File metadata and controls

52 lines (34 loc) · 1.14 KB

Output dates in a specific timezone while still maintaining UTC in the database

The package provides a custom cast class that can be applied to your model attributes and will output dates in your desired timezone while maintaining the application's globally set timezone when persisting to the database.

Installation

You can install the package via composer:

composer require network-rail-business-systems/laravel-date-timezone

You can publish the config file with:

php artisan vendor:publish --tag="date-timezone-config"

This is the contents of the published config file:

return [
    'output-timezone' => env('OUTPUT_TIMEZONE', config('app.timezone'))
];

Usage

protected $casts = [
    'created_at' => NetworkRailBusinessSystems\LaravelDateTimezone\Casts\DateTimezone::class;
]

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.