ariaieboy / filament-jalali-datetimepicker
This is my package filament-jalali-datetimepicker
Installs: 19 741
Dependents: 2
Suggesters: 0
Security: 0
Stars: 24
Watchers: 2
Forks: 1
Open Issues: 2
Language:JavaScript
pkg:composer/ariaieboy/filament-jalali-datetimepicker
Requires
- php: ~8.2.0|~8.3|~8.4
- filament/filament: ^3
- illuminate/contracts: ^11
- spatie/laravel-package-tools: ^1.13.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.11
- larastan/larastan: ^2.2
- nunomaduro/collision: ^8
- orchestra/testbench: ^9
- pestphp/pest: ^2
- pestphp/pest-plugin-laravel: ^2
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.1.1
- spatie/laravel-ray: ^1.30
README
Filament Jalali Date Time Picker Field
This package adds jalali support to filament v3 DatePicker and DateTimePicker.
For Filament v2 you can use the version 1 of this package.
Installation
You can install the package via composer:
composer require ariaieboy/filament-jalali-datetimepicker
Usage
use Ariaieboy\FilamentJalaliDatetimepicker\Forms\Components\JalaliDatePicker; use Ariaieboy\FilamentJalaliDatetimepicker\Forms\Components\JalaliDateTimePicker; \Filament\Forms\Components\DatePicker::make('birth_date')->jalali(); \Filament\Forms\Components\DateTimePicker::make('birth_date')->jalali(weekdaysShort: true);
for more information check the default DateTimePicker Docs : https://filamentphp.com/docs/2.x/forms/fields#date-time-picker
Changelog
Please see CHANGELOG for more information on what has changed recently.
Upgrading
v2 to v3
- step 1: Change the package version in your
composer.jsonto^3and run the composer update command:
"ariaieboy/filament-jalali-datetimepicker": "^3",
- step 2 : If you using the
JalaliDateTimePickerorJalaliDatePickerclasses you should remove those and use the default Filament DatePicker class.- For more info check the step 2 of the v1 to v2 upgrade guide.
- step 3 (optional) : in V3 we introduced 2 new lang files called
monthsanddaysusing these 2 file you can customize the months and days labels.- To customize the lang files you can use this command:
php artisan vendor:publish --tag=filament-jalali-datetimepicker-translations
- To customize the lang files you can use this command:
- backward compatibility checks:
- in V3 we changed some default values if you want to customize these values, you should use the methods after the
jalalimethod.- The default day label is
longto change this you should passtrueas the firstjalali(weekdaysShort: true)argument. - We changed the default start of the week to
saturday - the default format is changed to
Y-m-dandY-m-d H:i:sfordatePickeranddateTimePicker
- The default day label is
- We changed the underlying package that provide jalali compatibility for dayjs to
@calidy/dayjs-calendarsystems - In V3 we only support
laravel >= 11andphp >= 8.2
- in V3 we changed some default values if you want to customize these values, you should use the methods after the
v1 to v2
- step 1:Change the package version in your
composer.jsonto^2and run the composer update command:
"ariaieboy/filament-jalali-datetimepicker": "^2",
-
step 2 (optional):
You can change
jalaliDatePickerandjalaliDateTimePickerto the defaultDatePickerandDateTimePickerand then usejalali()method to convert a datepicker to jalali format For example:
//convert JalaliDateTimePicker::make('birth_date'), // to Forms\Components\DateTimePicker::make('birth_date')->jalali(), //and //convert JalaliDatePicker::make('birth_date'), //to \Filament\Forms\Components\DatePicker::make('birth_date')->jalali()
The old format will work in v2 but we might remove it in the next major versions.
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.