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

This package is abandoned and no longer maintained. No replacement package was suggested.

A simple package that sets the output of dates to a specific timezone while still maintaining UTC in the database

1.0.0 2022-09-02 13:12 UTC

This package is auto-updated.

Last update: 2023-03-30 14:32:40 UTC


README

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.