This package adds buddhistEra support to filament v3 DatePicker
and DateTimePicker
.
https://filamentphp.com/docs/3.x/forms/fields/date-time-picker
You can install the package via composer:
composer require zenepay/filament-buddhist-date-picker
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
DatePicker::make('start_date')->buddhist();
DateTimePicker::make('start_date')->buddhist();
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
DatePicker::make('start_at')->buddhist(false);
DatetimePicker::make('start_at')->buddhist(false);
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
DatePicker::make('birth_date')->buddhist(onlyLocales:['th','en']);
DateTimePicker::make('birth_date')->buddhist(onlyLocales:['th','en']);
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
DatePicker::make('start_at')->buddhist(lyLocales:on['th','en'],weekdaysMin:true);
DatetimePicker::make('start_at')->buddhist(onlyLocales:['th','en'],weekdaysMin:true);
You can also use this way
use Zenepay\FilamentBuddhistDatePicker\BuddhistDatePicker;
BuddhistDatePicker::make('start_date');
BuddhistDatePicker::make('birth_date')->onlyLocales(['th','en'])->weekdaysMin(false);
Or make alias to DatePicker and replace use Filament\Forms\Components\DatePicker to use Zenepay\FilamentBuddhistDatePicker\BuddhistDatePicker as DatePicker
//use Filament\Forms\Components\DatePicker -->
use Zenepay\FilamentBuddhistDatePicker\BuddhistDatePicker as DatePicker;
DatePicker::make('start_date');
DatePicker::make('birth_date')->onlyLocales(['th','en'])->weekdaysMin(false);
For Datetime format with AM PM 12H, which was available at filamentphp/filament#6441, now it can be combined with Buddhist Era as optional.
use Filament\Forms\Components\DateTimePicker;
DatetimePicker::make('start_at')->hourMode(12)->displayFormat('d/m/y h:i A')->seconds(false); // 15/02/24 11:10 PM
This can be done by replace $table->date() with $table->buddhistDate() for dateTime replace with $table->buddhistDateTime()
TextColumn::make('start_at')->buddhistDate(format:'m/d/Y',onlyLocales:['th']); // 15/02/2567
./vendor/bin/pest ./tests
- Water Billing
- user login: demo@example.com
- password: demo1234
The MIT License (MIT)
ใช้สำหรับ Larvavel 10 และ 11 Filament v3 DatePicker
DateTimePicker
.
รัน composer ที่ root ไดเร็กทอรีของ Laravel
composer require zenepay/filament-buddhist-date-picker
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
DatePicker::make('start_date')->buddhist();
DateTimePicker::make('start_date')->buddhist();
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
DatePicker::make('birth_date')->buddhist(onlyLocales:['th','en']);
DateTimePicker::make('birth_date')->buddhist(onlyLocales:['th','en']);
\Filament\Forms\Components\DatePicker::make('birth_date')->buddhist(onlyLocales:['th','en']);
\Filament\Forms\Components\DateTimePicker::make('birth_date')->buddhist(onlyLocales:['th','en']);
ให้เซ็ต weekdaysMin เป็น true หรือให้เป็นแบบสั้น อาทิตย์ จันทร์ อังคาร ให้เซ็ต เป็น false
use Filament\Forms\Components\DatePicker;
use Filament\Forms\Components\DateTimePicker;
DatePicker::make('start_at')->buddhist(onlyLocales:['th','en'],weekdaysMin:true);
DatetimePicker::make('start_at')->buddhist(onlyLocales:['th','en'],weekdaysMin:true);
หรือใช้แบบ เป็น component ใหม่แทนเลย ก็ใช้แบบนี้ได้
use Zenepay\FilamentBuddhistDatePicker\BuddhistDatePicker;
BuddhistDatePicker::make('start_date');
BuddhistDatePicker::make('birth_date')->onlyLocales(['th','en'])->weekdaysMin(false);
หรือเปลี่ยน การใช้ use Filament\Forms\Components\DatePicker เป็น ใช้ use Zenepay\FilamentBuddhistDatePicker\BuddhistDatePicker as DatePicker แทน เพื่อไม่ต้องไล่แก้ ใส่ buddhist() แต่ละ DatePicker component ในหน้านั้น
//use Filament\Forms\Components\DatePicker -->
use Zenepay\FilamentBuddhistDatePicker\BuddhistDatePicker as DatePicker;
DatePicker::make('start_date');
DatePicker::make('birth_date')->onlyLocales(['th','en'])->weekdaysMin(false);
For Datetime format with AM PM 12H, which was available at filamentphp/filament#6441, now it can be combined with Buddhist Era as optional.
use Filament\Forms\Components\DateTimePicker;
DatetimePicker::make('start_at')->hourMode(12)->displayFormat('d/m/y h:i A')->seconds(false); // 15/02/24 11:10 PM
This can be done by replace $table->date() with $table->buddhistDate() for dateTime replace with $table->buddhistDateTime()
TextColumn::make('start_at')->buddhistDate(format:'m/d/Y',onlyLocales:['th']); // 15/02/2567
./vendor/bin/pest ./tests
- Water Billing
- user login: demo@example.com
- password: demo1234
The MIT License (MIT)