fridzema/laravel-date-format-converter

Converts date format from js to php and the other way around
1,220 1
Install
composer require fridzema/laravel-date-format-converter
Latest Version:0.0.3
PHP:^8.2
Laravel:10 – 13
License:MIT
Last Updated:Mar 20, 2026
Links: GitHub  ·  Packagist
Maintainer: fridzema

Converts date format from js to php and the other way around

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Really simple package to convert js date format to php date format and the other way around.

    use Fridzema\DateFormatConverter\DateFormatConverter;

    it('converts JavaScript date formats to PHP date formats', function () {
        expect(DateFormatConverter::convertJsFormatToPhp('YYYY-MM-DD'))->toEqual('Y-m-d');
    });

    it('converts PHP date formats to JavaScript date formats', function () {
        expect(DateFormatConverter::convertPhpFormatToJs('Y-m-d'))->toEqual('YYYY-MM-DD');
    });

Installation

You can install the package via composer:

composer require fridzema/laravel-date-format-converter

You can publish the config file with:

php artisan vendor:publish --tag="laravel-date-format-converter-config"

Usage

$dateFormatConverter = new Fridzema\DateFormatConverter();

echo DateFormatConverter::convertPhpFormatToJs('Y-m-d');
echo DateFormatConverter::convertJsFormatToPhp('YYYY-MM-DD');

Testing

composer test

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

Related Packages

ellisio/laravel-phone

A phone validator for Laravel using the free Twilio phone lookup service.

29,983 11
jenssegers/date

A date library to help you work with dates in different languages

11,704,412 1,798
morilog/jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dat...

1,435,164 927
qwildz/localized-eloquent-date

Multi-language support for Laravel Eloquent's dates

14,443 4
jaybizzle/laravel-migrations-organiser

A Laravel package to help organise migration files.

426,748 112

Version History

Version Released PHP Laravel License
0.0.3 ^8.2 ^10.0||^11.0|^12.0|^13.0 MIT
0.0.2 ^8.2 ^10.0||^11.0|^12.0 MIT
0.0.1 ^8.2 ^10.0||^11.0 MIT