PHPackages                             anuzpandey/laravel-nepali-date - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. anuzpandey/laravel-nepali-date

ActiveLibrary[Localization &amp; i18n](/categories/localization)

anuzpandey/laravel-nepali-date
==============================

A Laravel Package to convert English Date (A.D.) to Nepali Date (B.S.) and vice-versa.

3.3.0(2mo ago)1921.3k↑62.3%12[1 PRs](https://github.com/anuzpandey/laravel-nepali-date/pulls)MITPHPPHP ^8.2|^8.3CI passing

Since Oct 24Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/anuzpandey/laravel-nepali-date)[ Packagist](https://packagist.org/packages/anuzpandey/laravel-nepali-date)[ Docs](https://laravel-nepali-date.anuzpandey.com)[ RSS](/packages/anuzpandey-laravel-nepali-date/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (20)Versions (31)Used By (0)

A Laravel Package to convert Dates from BS and AD.
==================================================

[](#a-laravel-package-to-convert-dates-from-bs-and-ad)

[![Latest Version on Packagist](https://camo.githubusercontent.com/011027e7fdbfd38d14d97479c3da0ddfc325a58688dd9081c5f411add205c50c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e757a70616e6465792f6c61726176656c2d6e6570616c692d646174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/anuzpandey/laravel-nepali-date)[![GitHub Tests Action Status](https://camo.githubusercontent.com/36329e2419c2bf322954fa665d4234510839f8e34fb8b453f91e4e00fb3f14e5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616e757a70616e6465792f6c61726176656c2d6e6570616c692d646174652f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/anuzpandey/laravel-nepali-date/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/43bb9faeab96482b80f7afbf1c4c6df475ed35c6f91c7734ebd257dc487fd009/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e757a70616e6465792f6c61726176656c2d6e6570616c692d646174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/anuzpandey/laravel-nepali-date)

LaravelNepaliDate is a Laravel package that simplifies the conversion of dates between the Gregorian (English) and Nepali (Bikram Sambat) calendars. This package is a handy tool for projects that require handling dates in both English and Nepali formats, such as websites and applications targeting users in Nepal.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require anuzpandey/laravel-nepali-date
```

Optionally, you can publish the config file with:

```
php artisan vendor:publish --tag="nepali-date-config"
```

Usage
-----

[](#usage)

```
$engDate = '1996-04-22';
LaravelNepaliDate::from($engDate)->toNepaliDate();
// Result: 2053-01-10

LaravelNepaliDate::from($engDate)->toNepaliDate(format: 'D, j F Y');
// Result: सोम, १० वैशाख २०५३

// Format Specifiers are supported and listed below
LaravelNepaliDate::from($engDate)->toNepaliDate(format: 'D, j F Y', locale: 'en');
// Result: Mon, 10 Baisakh 2053

$nepDate = '2053-01-10';
LaravelNepaliDate::from($nepDate)->toEnglishDate();
// Result: 1996-04-22

LaravelNepaliDate::from($nepDate)->toEnglishDate(format: 'l, jS F Y');
// Result: Sunday, 22nd April 1996

// Format Specifiers are supported and listed below
LaravelNepaliDate::from($nepDate)->toEnglishDate(format: 'l, j F Y', locale: 'np');
// Result: आइतबार, २२ बैशाख १९९६

// Get total days in a month of a year
use Anuzpandey\LaravelNepaliDate\Enums\NepaliMonth;
// month can be NepaliMonth::XXX or month number (1-12)
LaravelNepaliDate::daysInMonth(NepaliMonth::BAISAKH, 2053);
// Result: 31

// Get total days in a year
LaravelNepaliDate::daysInYear(2053);
// Result: 365
```

Format Specifiers
-----------------

[](#format-specifiers)

The following format specifiers are supported for formatting dates:

- `Y` - Year in four digits
- `y` - Year in two digits
- `m` - Month in two digits with leading zero (01-12/०१-१२)
- `n` - Month in one or two digits without leading zero (1-12/१-१२)
- `M` - Month in three letters (Jan-Dec)
- `F` - Month in full name (January-December/बैशाख-चैत्र)
- `d` - Day in two digits with leading zero (01-31/०१-३२)
- `j` - Day in one or two digits without leading zero (1-31/१-३२)
- `D` - Day in three letters (Sun-Sat/आइत-शनि)
- `l` - Day in full name (Sunday-Saturday/आइतबार-शनिबार)
- `S` - Day in two letters (st, nd, rd, th)

Extending Carbon with NepaliDateMixin
-------------------------------------

[](#extending-carbon-with-nepalidatemixin)

> **Note:** This feature has been deprecated as Carbon doesn't support the months having more than 31 days. This feature has been removed from version 2.0.0.

### Helper function

[](#helper-function)

```
// Convert English date to Nepali date (B.S.).
toNepaliDate("1996-04-22")
// Result: 2053-01-10

// Convert Nepali date to English date (A.D.).
toEnglishDate("2053-01-10")
// Result: 1996-04-22
```

Blade Directives
----------------

[](#blade-directives)

You can use the Blade directives directly in your views:

```
{{-- Convert English date to Nepali date --}}
@nepaliDate('1996-04-22')
{{-- Result: 2053-01-10 --}}

{{-- With format --}}
@nepaliDate('1996-04-22', 'l, d F Y')
{{-- Result: सोमबार, १० वैशाख २०५३ --}}

{{-- With format and locale --}}
@nepaliDate('1996-04-22', 'l, d F Y', 'en')
{{-- Result: Monday, 10 Baisakh 2053 --}}

{{-- Convert Nepali date to English date --}}
@englishDate('2053-01-10')
{{-- Result: 1996-04-22 --}}

{{-- With format --}}
@englishDate('2053-01-10', 'l, d F Y')
{{-- Result: सोमबार, २२ अप्रिल १९९६ --}}

{{-- With format and locale --}}
@englishDate('2053-01-10', 'l, d F Y', 'en')
{{-- Result: Monday, 22 April 1996 --}}
```

Artisan Commands
----------------

[](#artisan-commands)

Run quick conversions from the CLI:

```
php artisan nepali-date:convert --from=1996-04-22 --to=np
php artisan nepali-date:today
php artisan nepali-date:range --from=2080-01-01 --until=2080-01-05 --calendar=np --to=en
```

Common options:

- `--format=` Output format (defaults to `config('nepali-date.default_format')`)
- `--locale=` Output locale `en` or `np`
- `--strict` Enable stricter date validation
- `--json` Emit JSON output
- `--timezone=` Timezone for `today`

Getting Date as Array
---------------------

[](#getting-date-as-array)

You can get the date components as an array for more flexibility:

```
$engDate = '1996-04-22';
$dateArray = LaravelNepaliDate::from($engDate)->toNepaliDateArray();
// Returns NepaliDateArrayData object with:
// - year: '2053'
// - month: '01'
// - day: '10'
// - npYear: '२०५३'
// - npMonth: '०१'
// - npDay: '१०'
// - dayName: 'Monday'
// - monthName: 'Baisakh'
// - npDayName: 'सोमबार'
// - npMonthName: 'वैशाख'

$nepDate = '2053-01-10';
$dateArray = LaravelNepaliDate::from($nepDate)->toEnglishDateArray();
// Returns similar structure with English date data
```

Supported Date Ranges
---------------------

[](#supported-date-ranges)

CalendarFromToEnglish (A.D.)1944-01-012033-12-31Nepali (B.S.)2000-09-172099-12-30Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [AnuzPandey](https://github.com/anuzpandey)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance86

Actively maintained with recent releases

Popularity40

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~38 days

Recently: every ~20 days

Total

25

Last Release

67d ago

Major Versions

1.7.1 → 2.0.02024-05-12

2.4.0 → 3.0.02026-02-05

PHP version history (4 changes)1.0.0PHP ^7.4|^8.0

1.1.0PHP ^8.1

2.4.0PHP ^8.2

3.3.0PHP ^8.2|^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25082225?v=4)[Anuz Pandey](/maintainers/anuzpandey)[@anuzpandey](https://github.com/anuzpandey)

---

Top Contributors

[![anuzpandey](https://avatars.githubusercontent.com/u/25082225?v=4)](https://github.com/anuzpandey "anuzpandey (108 commits)")[![sagarhumagain](https://avatars.githubusercontent.com/u/37103603?v=4)](https://github.com/sagarhumagain "sagarhumagain (7 commits)")[![achyutkneupane](https://avatars.githubusercontent.com/u/30431426?v=4)](https://github.com/achyutkneupane "achyutkneupane (6 commits)")[![dineshuprety](https://avatars.githubusercontent.com/u/51488661?v=4)](https://github.com/dineshuprety "dineshuprety (4 commits)")[![ChandanShakya](https://avatars.githubusercontent.com/u/70548117?v=4)](https://github.com/ChandanShakya "ChandanShakya (1 commits)")

---

Tags

ad-to-bs-datelaravel-ad-to-bslaravel-nepali-datelaravel-nepali-date-converternepali-date-converterlaravelnepali-dateanuzpandeylaravel-nepali-datenepali-date-converter

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/anuzpandey-laravel-nepali-date/health.svg)

```
[![Health](https://phpackages.com/badges/anuzpandey-laravel-nepali-date/health.svg)](https://phpackages.com/packages/anuzpandey-laravel-nepali-date)
```

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M101](/packages/dedoc-scramble)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[elegantly/laravel-translator

All on one translations management for Laravel

6333.1k](/packages/elegantly-laravel-translator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
