IranianDatePicker-filament
IranianDatePicker-filament copied to clipboard
The IranianDatePicker package adds the Iranian date field to the filament
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.
Instalation
composer require shayanys/iranian-date-picker
Usage
in your form schema write:
IranianDatePickerField::make('date')
Methods
The methods you can use in IranianDatePicker are as follows
minDate
IranianDatePickerField::make('date')->minDate(now());
This method receives a carbon date to determine the minimum date that the user can choose.
maxDate
IranianDatePickerField::make('date')->maxDate(now()->addDays(10));
This method receives a carbon date to determine the maximum date that the user can choose.
format
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).
displayFormat
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.
withoutTime
IranianDatePickerField::make('date')->withoutTime();
The withoutTime method loads the date picker without the time picker
withoutSeconds
IranianDatePickerField::make('date')->withoutSeconds();
The withoutSeconds method loads the date picker and time picker without seconds
hourStep, minuteStep, and secondStep
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();
disabledDates
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).
disabledDates
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
column
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');
CHANGELOG
you can see change logs in CHANGELOG.md
license
Freely distributable under the terms of the MIT license.
This package legally
uses IranSans font.