PHPackages                             sagartimilsina/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sagartimilsina/nepali-date

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sagartimilsina/nepali-date
==========================

Convert dates between Bikram Sambat (BS) and Gregorian (AD), with English and Nepali (Devanagari) input support, for PHP and Laravel.

v2.1.0(1mo ago)029MITPHPPHP ^8.2

Since Jul 8Pushed 1mo agoCompare

[ Source](https://github.com/timilsinasagar/Nepali-Date-Converter-Package)[ Packagist](https://packagist.org/packages/sagartimilsina/nepali-date)[ RSS](/packages/sagartimilsina-nepali-date/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

Nepali Date Converter for PHP &amp; Laravel
===========================================

[](#nepali-date-converter-for-php--laravel)

[![Latest Version](https://camo.githubusercontent.com/38c17d55b02f169ec9fd7bbfae1bc1f4a7d0e890171401a61db6347caf14bbae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736167617274696d696c73696e612f6e6570616c692d646174652e737667)](https://packagist.org/packages/sagartimilsina/nepali-date)[![PHP Version](https://camo.githubusercontent.com/79651b3dd47fb5c0ab124e47932e21e314ec19c77212926a5b319d63ea11094a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736167617274696d696c73696e612f6e6570616c692d646174652e737667)](https://packagist.org/packages/sagartimilsina/nepali-date)[![License](https://camo.githubusercontent.com/63527254647af32cf753030e0a112f8abda965d0a5ea018b4ef553ab2f9decd6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736167617274696d696c73696e612f6e6570616c692d646174652e737667)](LICENSE)

This package converts dates between **Nepali (BS)** and **English (AD)** calendars.

It works in plain PHP and also in Laravel (versions 10, 11, 12, and 13). If you use Laravel, it sets itself up automatically — you don't need to register anything.

> **Coming from version 1.x?** In version 2.0.0, `adToBs()` and `bsToAd()` now give you a full object with lots of details, instead of just a plain text string. See [CHANGELOG.md](CHANGELOG.md) if you need the old string-only behavior — it's still there under different method names.

---

What this package can do
------------------------

[](#what-this-package-can-do)

- Convert **AD date → BS date**, and **BS date → AD date**
- Give you the year, month, day, weekday — in both English and Nepali
- Give you today's date in BS or AD instantly (`todayBS()`, `todayAD()`)
- Accept dates typed in English numbers (2082) or Nepali numbers (२०८२)
- Accept BS dates in different formats, like `"2082-03-24"` or `"24 Ashadh 2082"`
- Work completely offline — no internet or external API needed
- Come with a ready-made demo page you can turn on to test it visually

---

What you need before installing
-------------------------------

[](#what-you-need-before-installing)

- PHP 8.2 or newer
- Laravel 10, 11, 12, or 13 (optional — you can also use this without Laravel)

---

How to install it
-----------------

[](#how-to-install-it)

Run this command in your project folder:

```
composer require sagartimilsina/nepali-date
```

That's it — if you're using Laravel, it's ready to use right away.

If you want to change any settings later, publish the config file:

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

---

How to use it (Laravel)
-----------------------

[](#how-to-use-it-laravel)

**Convert an English date to a Nepali date:**

```
use Sagartimilsina\NepaliDate\Facades\NepaliDate;

$result = NepaliDate::adToBs('2026-07-08');

$result->year;          // 2083
$result->month;         // 3
$result->day;            // 24
$result->monthNameEn;    // "Ashadh"
$result->monthNameNp;    // "असार"
$result->weekdayEn;      // "Wednesday"
$result->weekdayNp;      // "बुधबार"
$result->formattedEn;    // "24 Ashadh 2083"
$result->formattedNp;    // "२४ असार २०८३"
```

**Convert a Nepali date to an English date:**

```
$carbon = NepaliDate::bsToAd('2083-03-24');

$carbon->format('Y-m-d');   // "2026-07-08"
```

---

All the available methods
-------------------------

[](#all-the-available-methods)

### Main methods (recommended)

[](#main-methods-recommended)

MethodWhat you give itWhat you get back`adToBs`an AD datefull details (year, month, day, weekday, etc.)`bsToAd`a BS datean AD date (Carbon object)`toCarbon`a BS datesame as `bsToAd()``todayBS`nothingtoday's date in BS, with full details`todayAD`nothingtoday's date in AD`nowBS`nothingthe current BS date and time`nowAD`nothingthe current AD date and time`getSupportedYearRange`nothingthe earliest and latest year this package supports### What you get back from `adToBs()`

[](#what-you-get-back-from-adtobs)

You can accessWhat it means`$year`, `$month`, `$day`the numbers`$monthNameEn`, `$monthNameNp`month name in English / Nepali`$weekdayEn`, `$weekdayNp`day of week in English / Nepali`$formattedEn`, `$formattedNp`ready-to-display text, e.g. "24 Ashadh 2083"`$carbon`the matching English date, as a normal Carbon date`toDateString()`gives you "2083-03-24"### Old methods from version 1.x (still work, just simpler output)

[](#old-methods-from-version-1x-still-work-just-simpler-output)

If you're on an older version and don't want to change your code, these still work and just return plain text instead of a full object:

`adToBsString`, `bsToAdString`, `bsToNepaliText`, `format`, `getMonth`, `getDay`, `getDayName`, `today`

---

Using it without Laravel
------------------------

[](#using-it-without-laravel)

```
require 'vendor/autoload.php';

use Sagartimilsina\NepaliDate\NepaliDate;

$date = new NepaliDate();

$result = $date->adToBs('2026-07-08');
echo $result->formattedEn;   // "24 Ashadh 2083"

$carbon = $date->bsToAd('2083-03-24');
echo $carbon->format('Y-m-d');   // "2026-07-08"
```

---

Try it out with the built-in demo page
--------------------------------------

[](#try-it-out-with-the-built-in-demo-page)

This package includes a ready-made web page where you can type a date and see it converted instantly. It's **turned off by default** for safety — it won't show up on your site unless you turn it on.

To turn it on, add this to your `.env` file:

```
NEPALI_DATE_DEMO_ROUTE=true
```

Then visit `/nepali-date-demo` in your browser.

⚠️ **Remember to turn this off before going live** — it's only meant for testing on your own computer.

---

What happens if someone types an invalid date?
----------------------------------------------

[](#what-happens-if-someone-types-an-invalid-date)

The package will stop and throw an error instead of silently giving a wrong answer:

```
try {
    NepaliDate::bsToAd('not-a-date');
} catch (\InvalidArgumentException $e) {
    // "Unable to parse BS date: not-a-date"
}
```

If someone submits the demo form with bad data, it gets rejected before any conversion is even attempted.

---

How accurate is it?
-------------------

[](#how-accurate-is-it)

The date table this package uses has been checked against another trusted Nepali date converter website, at several points between BS 2060 and 2083 — including New Year dates. All of them matched, including the correct day of the week.

Two honest notes:

- Years **BS 2000–2090** are well-checked and safe to trust.
- Years **BS 2091–2100** (the very end of the range) haven't been double-checked as thoroughly — use with a little more caution if you're working in that range.

Found a date that looks wrong? Please open an issue on GitHub with the date and a source, and it'll get fixed.

---

Running the tests
-----------------

[](#running-the-tests)

```
composer install
composer test
```

Or run PHPUnit directly:

```
vendor/bin/phpunit
```

---

Code style check
----------------

[](#code-style-check)

```
composer lint     # just checks
composer format   # auto-fixes formatting
```

---

Want to understand how it works internally?
-------------------------------------------

[](#want-to-understand-how-it-works-internally)

See [ARCHITECTURE.md](ARCHITECTURE.md) — it explains step by step what happens when you convert a date, and why the code is organized the way it is.

---

Version history
---------------

[](#version-history)

This package follows normal version numbering rules (Semantic Versioning). Full history is in [CHANGELOG.md](CHANGELOG.md).

---

Want to contribute?
-------------------

[](#want-to-contribute)

1. Fork this repository
2. Create a new branch for your change
3. Run `composer lint` and `composer test` — make sure both pass
4. Commit your change
5. Push your branch
6. Open a Pull Request

---

What's planned next
-------------------

[](#whats-planned-next)

- BS ↔ AD conversion
- Nepali number support
- Laravel integration
- Month / weekday names
- Full text date formatting
- Carbon integration
- Demo page
- Blade component (``)
- A visual Nepali date picker
- Better ordinal day formatting (1st, 2nd, 3rd...)

---

License
-------

[](#license)

Free to use — [MIT License](LICENSE).

---

Author
------

[](#author)

**Sagar Timilsina** — Laravel &amp; Full Stack Developer

- GitHub:
- Packagist:

If this package was useful to you, a ⭐ on GitHub is always appreciated.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

48d ago

Major Versions

v1.1.0 → v2.0.02026-07-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/71d12d89ba9bf9c5dba50b0039332b92ac05a67eb7d665798ee78d6f28c250e6?d=identicon)[timilsinasagar](/maintainers/timilsinasagar)

---

Top Contributors

[![timilsinasagar](https://avatars.githubusercontent.com/u/242016507?v=4)](https://github.com/timilsinasagar "timilsinasagar (10 commits)")

---

Tags

laravelnepali-datebikram-sambatbs-to-adad-to-bsNepali Calendar

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k99.8M360](/packages/laravel-horizon)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k31.8M163](/packages/laravel-cashier)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)

PHPackages © 2026

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