etdatepickerlaravel/ethiopian-datepicker
Composer 安装命令:
composer require etdatepickerlaravel/ethiopian-datepicker
包简介
A comprehensive Laravel package for Ethiopian calendar datepicker with Gregorian calendar conversion
关键字:
README 文档
README
A comprehensive Laravel package that provides Ethiopian calendar datepicker functionality with Gregorian calendar conversion. Perfect for applications that need to support Ethiopian date selection with accurate conversion between Ethiopian and Gregorian calendars.
Features
- 📅 Dual Calendar Support: Switch between Ethiopian and Gregorian calendars
- 🔄 Accurate Date Conversion: Precise conversion between Ethiopian and Gregorian dates
- 🌍 Localization: Support for Amharic, transliterated, and English day/month names
- 📱 Responsive Design: Mobile-friendly interface
- 🎨 Customizable: Configurable themes and styling options
- ⚡ Laravel Integration: Blade components and Laravel-specific features
- 🔧 Easy Installation: Simple composer installation and configuration
Requirements
- PHP 7.4 or higher
- Laravel 8.0 or higher
Installation
Step 1: Install via Composer
composer require etdatepickerlaravel/ethiopian-datepicker
Step 2: Publish Assets (Optional)
Publish the configuration file:
php artisan vendor:publish --tag=ethiopian-datepicker-config
Publish the assets (CSS and JavaScript):
php artisan vendor:publish --tag=ethiopian-datepicker-assets
Publish the views (if you want to customize them):
php artisan vendor:publish --tag=ethiopian-datepicker-views
Or publish everything at once:
php artisan vendor:publish --tag=ethiopian-datepicker
Usage
Basic Usage
Using Blade Component
<x-ethiopian-datepicker name="birth_date" placeholder="Select your birth date" :required="true" />
With Custom Options
<x-ethiopian-datepicker name="event_date" id="event-date-picker" placeholder="Select event date" :show-gregorian="true" :show-ethiopian="true" default-calendar="ethiopian" classes="form-control custom-class" />
In Your Blade Layout
Make sure to include the styles and scripts in your layout:
<!DOCTYPE html> <html> <head> <!-- Other head elements --> @stack('styles') </head> <body> <!-- Your content --> @stack('scripts') </body> </html>
Using in Forms
<form method="POST" action="/events"> @csrf <div class="form-group"> <label for="event_date">Event Date</label> <x-ethiopian-datepicker name="event_date" :value="old('event_date')" :required="true" /> @error('event_date') <span class="error">{{ $message }}</span> @enderror </div> <button type="submit">Save Event</button> </form>
JavaScript API
You can also initialize the datepicker programmatically:
// Initialize Ethiopian datepicker const datepicker = new EthiopianDatepicker(document.getElementById('my-date-input'), { showGregorian: true, showEthiopian: true, defaultCalendar: 'ethiopian', onChange: function(data) { console.log('Ethiopian Date:', data.ethiopian); console.log('Gregorian Date:', data.gregorian); console.log('Formatted:', data.formatted); } });
PHP Usage
You can also use the Ethiopian calendar conversion in your PHP code:
use WorthyERP\EthiopianDatepicker\EthiopianCalendar; $calendar = new EthiopianCalendar(); // Convert Gregorian to Ethiopian $ethiopianDate = $calendar->toEthiopian(new DateTime('2024-01-15')); // Returns: ['year' => 2016, 'month' => 5, 'day' => 6, 'monthName' => 'Tir', ...] // Convert Ethiopian to Gregorian $gregorianDate = $calendar->toGregorian(2016, 5, 6); // Returns: DateTime object // Get today in Ethiopian calendar $today = $calendar->today(); // Format Ethiopian date $formatted = $calendar->format($ethiopianDate, 'full'); // Returns: "Monday, 6 Tir 2016"
Configuration
The configuration file config/ethiopian-datepicker.php allows you to customize:
- Default calendar type (Gregorian or Ethiopian)
- Date formats
- Language settings
- Styling options
- Validation rules
return [ 'default_calendar' => 'gregorian', 'show_both_calendars' => true, 'date_format' => [ 'gregorian' => 'Y-m-d', 'ethiopian' => 'd/m/Y', ], 'language' => [ 'month_names' => [...], 'weekday_names' => [...], ], // ... more options ];
Component Properties
| Property | Type | Default | Description |
|---|---|---|---|
name |
string | 'date' | Input name attribute |
id |
string | null | Input ID (defaults to name) |
value |
string | null | Initial value |
placeholder |
string | 'Select a date...' | Placeholder text |
required |
boolean | false | Whether the field is required |
showGregorian |
boolean | true | Show Gregorian calendar option |
showEthiopian |
boolean | true | Show Ethiopian calendar option |
defaultCalendar |
string | 'gregorian' | Default calendar to display |
classes |
string | '' | Additional CSS classes |
Ethiopian Calendar Information
The Ethiopian calendar has:
- 13 months: 12 months of 30 days each, plus Pagumen (5 or 6 days)
- Leap years: Occur every 4 years (when year % 4 = 3)
- New Year: Meskerem 1 (around September 11 in Gregorian)
- 7-8 year difference: Ethiopian year is 7-8 years behind Gregorian
Month Names
- Meskerem (መስከረም)
- Tikimt (ጥቅምት)
- Hidar (ኅዳር)
- Tahsas (ታኅሣሥ)
- Tir (ጥር)
- Yekatit (የካቲት)
- Megabit (መጋቢት)
- Miazia (ሚያዝያ)
- Ginbot (ግንቦት)
- Sene (ሰኔ)
- Hamle (ሐምሌ)
- Nehase (ነሐሴ)
- Pagumen (ጳጉሜን)
Examples
Example 1: Birth Date Field
<div class="form-group"> <label>Birth Date</label> <x-ethiopian-datepicker name="birth_date" placeholder="Select birth date" :show-gregorian="true" :show-ethiopian="true" default-calendar="ethiopian" /> </div>
Example 2: Event Date with Validation
<x-ethiopian-datepicker name="event_date" :value="$event->date ?? old('event_date')" :required="true" classes="@error('event_date') is-invalid @enderror" />
Example 3: Ethiopian Only
<x-ethiopian-datepicker name="ethiopian_date" :show-gregorian="false" :show-ethiopian="true" default-calendar="ethiopian" />
Browser Support
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This package is open-sourced software licensed under the MIT license.
Credits
- Developed by EtDatepickerLaravel
- Ethiopian calendar conversion algorithms based on established conversion methods
- Inspired by the need for accurate Ethiopian date handling in Laravel applications
Support
For issues, questions, or suggestions, please open an issue on GitHub.
Changelog
Version 1.0.0
- Initial release
- Ethiopian calendar support
- Gregorian calendar integration
- Blade component
- JavaScript API
- PHP conversion utilities
etdatepickerlaravel/ethiopian-datepicker 适用场景与选型建议
etdatepickerlaravel/ethiopian-datepicker 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「calendar」 「conversion」 「laravel」 「datepicker」 「hijri」 「ethiopian」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 etdatepickerlaravel/ethiopian-datepicker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 etdatepickerlaravel/ethiopian-datepicker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 etdatepickerlaravel/ethiopian-datepicker 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A library that provides a simple infrastructure to create your own converters and to perform any conversion you want
A modern PHP library for generating iCalendar v2.0 events
A powerful event calendar Tool for Laravel's Nova 5.
Check for holidays - localeaware
Fixer.io data provider for Peso
This TYPO3 distribution provides a sample website using bootstrap and the extensions pizpalue and container_elements. The distribution tailors Swiss market featuring German as default language and additional translations to French, English and Finnish.
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 33
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-23