{"repo":"whitecube/laravel-timezones","free":true,"listed":false,"github":"https://github.com/whitecube/laravel-timezones","clone":"git clone https://github.com/whitecube/laravel-timezones.git","description":"Store UTC dates in the database and work with custom timezones in the application","language":"PHP","stars":108,"topics":["laravel","laravel-package"],"license":"MIT","category":"databases-storage","readme_excerpt":"Laravel Timezones Dealing with timezones can be a frustrating experience. Here's an attempt to brighten your day. The problem: it is commonly agreed that dates should be stored as UTC datetimes in the database, which generally means they also need to be adapted for the local timezone before manipulation or display. Laravel provides a app.timezone configuration, making it possible to start working with timezones. However, changing that configuration will affect both the stored and manipulated date's timezones. This package tries to address this by providing a timezone conversion mechanism that should perform most of the repetitive timezone configurations out of the box. Installation Getting started The app.timezone configuration setting has to be set to the timezone that should be used when saving dates in the database. We highly recommend keeping it as UTC since it's a global standard for dates storage. For in-app date manipulation and display, one would expect more flexibility. That's why it is possible to set the application's timezone dynamically by updating the timezone singleton instance. Depending on the app's context, please choose one that suits your situation best: 1. Using middleware Useful when the app's timezone should be set by ther user's settings. 2. Using a Service Provider Useful when the app's timezone should be set by the application itself. For instance, in App\\Providers\\AppServiceProvider : Usage Once everything's setup, the easiest way to manipulate date","default_branch":null,"files":null,"tree":[],"storefront":"/r/whitecube","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/whitecube/laravel-timezones/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}