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 Converter Classes.
use Pratiksh\Nepalidate\Services\NepaliDate;
NepaliDate::create(\Carbon\Carbon::now())->toBS(); // 2082-02-04
NepaliDate::create(\Carbon\Carbon::now())->toFormattedEnglishBSDate(); // 4 Jestha 2082, Sunday
NepaliDate::create(\Carbon\Carbon::now())->toFormattedNepaliBSDate(); // ४ जेठ २०८२, आइतवार
By Using Helper Function.
toBS(\Carbon\Carbon::now()); // 2082-02-04
toFormattedEnglishBSDate(\Carbon\Carbon::now()); // 4 Jestha 2082, Sunday
toFormattedNepaliBSDate(\Carbon\Carbon::now()); // ४ जेठ २०८२, आइतवार
toDetailBS(\Carbon\Carbon::now()); // {
"year": 2082,
"month": "02",
"day": "04",
"dayOfWeek": 1,
}
use Pratiksh\Nepalidate\Services\EnglishDate;
EnglishDate::create("2082-02-04")->toAD(); //2025-05-18
EnglishDate::create("2082-02-04")->toAD('Y-m-d g:i A'); // 2025-05-18 12:00 AM
EnglishDate::create("2082-02-04")->toCarbon(); // To Carbon instance
EnglishDate::create("2082-02-04")->date; // Carbon instance
By Using Helper Functions
toAD("2082-02-04"); // Carbon instance
This new version include major updates that could break the code.
toFormattedBSDate(Carbon $date)
changed totoFormattedEnglishBSDate(Carbon $date)
toFormattedNepaliDate(Carbon $date)
changed totoFormattedNepaliBSDate(Carbon $date)
- Facades are removed.
./vendor/bin/pest
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.