Giter Club home page Giter Club logo

iraniandatepicker-filament's Introduction

IraninaDatePicker-filament license IraninaDatePicker-filament size IraninaDatePicker-filament version

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.

iraniandatepicker-filament's People

Contributors

shayan-yousefi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.