Laravel package to convert AD to BS that can work with carbon.
You can install the package via composer:
composer require pratiksh/nepalidate
By Using Facade.
use Pratiksh\Nepalidate\Facades\NepaliDate;
NepaliDate::create(\Carbon\Carbon::now())->toBS(); // 2078-4-21
NepaliDate::create(\Carbon\Carbon::now())->toFormattedBSDate(); // 21 Shrawan 2078, Thurday
NepaliDate::create(\Carbon\Carbon::now())->toFormattedNepaliDate(); // २१ साउन २०७८, बिहिवार
By Using Helper Function.
use Pratiksh\Nepalidate\Facades\NepaliDate;
toBS(\Carbon\Carbon::now()); // 2078-4-21
toFormattedBSDate(\Carbon\Carbon::now()); // 21 Shrawan 2078, Thurday
toFormattedNepaliDate(\Carbon\Carbon::now()); // २१ साउन २०७८, बिहिवार
Mode Controlled Nepali Date Helper
for this to work publish config file
php artisan vendor:publish --provider="Pratiksh\Nepalidate\Providers\NepalidateServiceProvider"
then in config
<?php
return [
/*
|--------------------------------------------------------------------------
| Nepali Date Return Mode
|--------------------------------------------------------------------------
| 1 = toBS
| 2 = toFormattedBSDate
| 3 = toFormattedBSDate
|
*/
'mode' => 1
];
// OUTPUT
// if mode = 1 then output 2078-4-21
// if mode = 2 then output 21 Shrawan 2078, Thurday
// if mode = 3 then output २१ साउन २०७८, बिहिवार
nepalidate(\Carbon\Carbon::now());
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email pratikdai404@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.