The IranianDatePicker-filament package was created to add the Iranian calendar field to the filament
thanks to babakhani for the wonderful pwt.datepicker javascript package.
composer require shayanys/iranian-date-picker
in your form schema write:
IranianDatePickerField::make('date')
The methods you can use in IranianDatePicker are as follows
IranianDatePickerField::make('date')->minDate(now());
This method receives a carbon date to determine the minimum date that the user can choose.
IranianDatePickerField::make('date')->maxDate(now()->addDays(10));
This method receives a carbon date to determine the maximum date that the user can choose.
IranianDatePickerField::make('date')->format('Y-m-d');
The format method is used to determine the date format (the date is stored in the database with the same format).
IranianDatePickerField::make('date')->displayFormat('Y/m/d');
// Use with the format method
IranianDatePickerField::make('date')->format('Y-m-d')->displayFormat('Y/m/d');
Maybe you want the format displayed in the field to be different from the format stored in the database, for this you can use the displayFormat method.
IranianDatePickerField::make('date')->withoutTime();
The withoutTime method loads the date picker without the time picker
IranianDatePickerField::make('date')->withoutSeconds();
The withoutSeconds method loads the date picker and time picker without seconds
IranianDatePickerField::make('date')->hourStep(2);
IranianDatePickerField::make('date')->minuteStep(2);
IranianDatePickerField::make('date')->secondStep(2);
You may also customize the input interval for increasing the hours / minutes / seconds using the hoursStep() , minutesStep() or secondsStep();
IranianDatePickerField::make('date')->disabledDates(['2023-03-17','2023-03-18','1402-01-01']);
The disabledDates method disables the dates passed with an array in the date selector (you can also enter a Iranian date).
IranianDatePickerField::make('date')->disabledWeekDays([0,1,2]); // this will disable saturday, sunday and monday
/*
* saturday => 0
* sunday => 1
* monday => 2
* tuesday => 3
* wednesday => 4
* thursday => 5
* friday => 6
*/
this method will disable passed days in date picker and add rule to ensure selected date is not in disabled days by this method
to show date in Iranian format use this column
IranianDatePickerColumn::make('date');
//you can use it with format method
IranianDatePickerColumn::make('date')->format('Y/m/d');
you can see change logs in CHANGELOG.md
Freely distributable under the terms of the MIT license.
This package legally
uses IranSans font.