Laravel package to convert AD to BS that can work with carbon.

Laravel Nepali Date Converter

Laravel Nepali Date Converter

Latest Version on PackagistStars Downloads StyleCI Build Status Scrutinizer Code Quality CodeFactor License

Laravel package to convert AD to BS that can work with carbon.

Installation

You can install the package via composer:


composer require pratiksh/nepalidate

Usages

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


'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());

3 thoughts on “Laravel package to convert AD to BS that can work with carbon.”

Leave a Comment

Scroll to Top