PHPackages                             codewiser/laravel-cast-datetime-tz - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. codewiser/laravel-cast-datetime-tz

AbandonedArchivedLibrary

codewiser/laravel-cast-datetime-tz
==================================

Cast datetime with timezone for Laravel

v1.0.4(1y ago)27251MITPHPPHP ^8.0.2CI passing

Since Jun 1Pushed 1y ago2 watchersCompare

[ Source](https://github.com/C0deWiser/laravel-cast-datetime-tz)[ Packagist](https://packagist.org/packages/codewiser/laravel-cast-datetime-tz)[ RSS](/packages/codewiser-laravel-cast-datetime-tz/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (6)Used By (1)

Cast datetime with timezone for Laravel
=======================================

[](#cast-datetime-with-timezone-for-laravel)

[![PHP Composer](https://github.com/C0deWiser/laravel-cast-datetime-tz/actions/workflows/php.yml/badge.svg)](https://github.com/C0deWiser/laravel-cast-datetime-tz/actions/workflows/php.yml)

Laravel doesn't respect timezone. Cast `\Codewiser\Casts\AsDatetimeWithTZ` fixes this wrong behaviour.

Before
------

[](#before)

```
class Article extends \Illuminate\Database\Eloquent\Model
{
    protected $casts = [
        'date' => 'datetime'
    ];
}
```

```
// e.g. Laravel has Europe/London (+01:00) timezone
config()->set('app.timezone', 'Europe/London');

$model = new Article();

$model->date = '2000-01-01T10:00:00+02:00';

echo $model->date->format('c');
// Expecting 2000-01-01T09:00:00+01:00
// Actual    2000-01-01T10:00:00+01:00
```

After
-----

[](#after)

```
class Article extends \Illuminate\Database\Eloquent\Model
{
    protected $casts = [
        'date' => \Codewiser\Casts\AsDatetimeWithTZ::class
    ];
}
```

```
// e.g. Laravel has Europe/London (+01:00) timezone
config()->set('app.timezone', 'Europe/London');

$model = new Article();

$model->date = '2000-01-01T10:00:00+02:00';

echo $model->date->format('c');
// Expecting 2000-01-01T09:00:00+01:00
// Actual    2000-01-01T09:00:00+01:00
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance46

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~159 days

Total

5

Last Release

435d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce23eaf7ae48d79d2b07efc83ff7cecb2664f428bd531b167b90169423f1453d?d=identicon)[Cellard](/maintainers/Cellard)

---

Top Contributors

[![Cellard](https://avatars.githubusercontent.com/u/1220316?v=4)](https://github.com/Cellard "Cellard (12 commits)")

---

Tags

laraveldatetimetimezonetz

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codewiser-laravel-cast-datetime-tz/health.svg)

```
[![Health](https://phpackages.com/badges/codewiser-laravel-cast-datetime-tz/health.svg)](https://phpackages.com/packages/codewiser-laravel-cast-datetime-tz)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[devrabiul/laravel-geo-genius

Laravel GeoGenius — A powerful, intelligent toolkit for geo-location, timezone, and locale-based features in Laravel applications.

1757.6k](/packages/devrabiul-laravel-geo-genius)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
