proshore/nepali-date-converter

Package to convert carbon date to nepali date

1.0.0 2024-03-05 05:38 UTC

This package is auto-updated.

Last update: 2024-05-06 05:07:40 UTC


README

This Laravel package provides functionality to convert dates from the Gregorian calendar (AD) to the Bikram Sambat calendar (BS) using the native Carbon library. It's especially useful for applications targeting Nepali users or systems where Bikram Sambat dates are relevant.

Features

  • Seamless conversion of dates from AD to BS and vice versa.
  • Integration with Laravel's native Carbon library for efficient and accurate date manipulation.
  • Simple to integrate into existing Laravel applications.

Tests Laravel Nepali Date Converter Code Analysis

Requirements

  • PHP >= 8.0
  • Carbon PHP Library

Installation

Composer

Install using composer

composer require proshore/laravel-nepali-date-converter

Publish your config file

php artisan vendor:publish --tag=nepali-date

Usages

You can directly convert Carbon date to Nepali date using chain function in Carbon.

Carbon\Carbon::now()->toBS();

To Bs Example

Get Formatted date

Carbon\Carbon::now()->toBSDate();

Carbon\Carbon::now()->toBSFormattedDate();

Formatted To Bs Example

Using without carbon

Proshore\NepaliDate\Facades\NepaliDateConverter::getBSbyAd(2024,03,01);

Proshore\NepaliDate\Facades\NepaliDateConverter::getADbyBS(2080,11,18);

Default converter

Get Carbon date from Bs Date

Proshore\NepaliDate\Facades\NepaliDateConverter::toAD(2080,11,18);

BS To Carbon Date

Contributers ✨

kundankarna1994.png