Skip to content

HELMAB/chhankitek

Repository files navigation

Chhankitek for Laravel

Convert from AD (Anno Domini) to Lunar (Chhankitek) format see more.

Installation

You can install the package via composer:

composer require asorasoft/chhankitek

Usage

// In Laravel controller, use this trait
use HasChhankitek;

// start call chhankitek method
$toLunarDate = $this->chhankiteck(Carbon::now());
$toLunarDate->toString(); // ថ្ងៃច័ន្ទ ៤ រោច ខែបឋមាសាឍ ឆ្នាំឆ្លូវ ត្រីស័ក ពុទ្ធសករាជ ២៥៦៥

Available methods

// In Laravel controller, use this trait
use HasChhankitek;

$toLunarDate = $this->chhankiteck(Carbon::now());

$toLunarDate->getDayOfWeek(); // អាទិត្យ, ច័ន្ទ...
$toLunarDate->getLunarDay(); // ១កើត, ២កើត...
$toLunarDate->getLunarMonth(); // ចេត្រ...
$toLunarDate->getLunarZodiac(); // ជូត, ឆ្លូវ...
$toLunarDate->getLunarEra(); // ត្រីស័ក...
$toLunarDate->getLunarYear(); // ២៥៦៥, ២៥៦៦..

Or we can use toLunarDate helper function.

toLunarDate(Carbon::now())->toString(); // ថ្ងៃច័ន្ទ ៤ រោច ខែបឋមាសាឍ ឆ្នាំឆ្លូវ ត្រីស័ក ពុទ្ធសករាជ ២៥៦៥

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Support

If you like this package and want to support me, you can buy me a coffee ☕

Credits

License

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

Authors and acknowledgment

This library might not exist without hardwork of these people:

  1. Base on algorithm of Mr.Phylypo Tum from Cam-CC
  2. Porting from momentkh by ThyrithSor into Java
  3. Khmer New Year Time Calculation
  4. Porting from MetheaX/khmer-chhankitek-calendar by MetheaX into Laravel Package