Search by

maarheeze / calendar-date-laravel

wietsewarendorff

laravel integration for a timezone-agnostic calendar date value object

Package info

github.com/maarheeze/calendar-date-laravel

pkg:composer/maarheeze/calendar-date-laravel

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0 2026-08-23 09:09 UTC

This package is auto-updated.

Last update: 2026-08-23 09:09:58 UTC


README

Laravel integration for maarheeze/calendar-date.

Installation

composer require maarheeze/calendar-date-laravel

Usage

Eloquent cast

use Maarheeze\CalendarDate\Laravel\Model\Casts\CalendarDateCast;

class Article extends Model
{
    protected $casts = [
        'publication_date' => CalendarDateCast::class,
    ];
}

The cast handles null and string values from the database, and stores as Y-m-d.

Blade

Since CalendarDate implements __toString(), it renders directly in Blade:

{{ $article->publication_date }} // results in 2000-01-01
{{ $article->publication_date->format('d-m-Y') }} // results in 01-01-2000

License

MIT