Giter Site home page Giter Site logo

shalior / filament-persian-date-field Goto Github PK

View Code? Open in Web Editor NEW
13.0 1.0 1.0 49 KB

A Filament php form field to pick Persian (jalali) dates

License: MIT License

PHP 72.94% Blade 27.06%
laravel filament-form laravel-package tall-stack jalali jalali-calendar jalali-date-picker persian persian-calendar persian-datepicker

filament-persian-date-field's Introduction

A FilamentPhp form field to pick persian (jalali) dates

Latest Version on Packagist Total Downloads

filament-demo

Installation

You can install the package via composer:

composer require shalior/filament-persian-date-field

To use with filament v2 use version ^1

You can publish the config file with:

php artisan vendor:publish --tag="filament-persian-date-field-config"

Usage

You'll use this component with Filament forms.

It syncs the related gregorian date (as string: Y-m-d) with your LiveWire component. Use the field like any other filament form fields:

    protected function getFormSchema(): array
    {
        return [
            \Shalior\FilamentPersianDateField\Components\PersianDatePicker::make('persianDate')
            ->id('persian-date')
            ->maxDate(now()->format('Y-m-d'))
            ->minDate(now()->subWeek()->format('Y-m-d'))
            ->withoutTime()
            ->viewMode('month') // accepts 'day', 'month', 'year'
            ->default('2022-04-28'),
        ];
    }

Persian date table column

You can use this field as a column in your table:

The column assumes you've installed verta or morilog/jalali if neither of them is installed, it will use Carbon's translatedFormat()

    Shalior\FilamentPersianDateField\Columns::make('created_at')
        ->translateLabel()
        ->format('Y/m/d') // default is 'H:i:s Y/m/d'
        ->timeZone('Asia/Tehran'), // default is 'Asia/Tehran'
        // renders as: ۱۳۹۹/۰۸/۰۱ in the table

Changelog

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

Contributing

I Encourage you to do so.

Credits

License

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

filament-persian-date-field's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar shalior avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

caspian-dev

filament-persian-date-field's Issues

Dark Theme for field

thanks for this great package.

I recommended to config persian-date field to set dark if the admin panel dark theme is active

Date value in carbon from data base doesnt converted to jajali in PersianDateColumn

I save the date value in database and this is my sample code:

PersianDatePicker::make('released_at')->id('released_at')->withoutTime()->viewMode('month')

Then when I try to show the column in the index page with this sample code:

PersianDateColumn::make('released_at')->translateLabel()->format('Y/m/d')

the carbon value from database doesn't convert to Jalali

I am using "filament/filament": "^2.17"

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.