PHPackages                             rohanadhikari/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. rohanadhikari/nepali-date

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

rohanadhikari/nepali-date
=========================

A PHP package for handling Nepali Date and Time (Bikram Sambat - BS), with AD/BS conversion, formatting, and Laravel support.

v1.0.2(3w ago)61.1k1MITPHPPHP ^8.1CI passing

Since Oct 18Pushed 3w ago1 watchersCompare

[ Source](https://github.com/rohanAdhikari1/NepalIDatePHP)[ Packagist](https://packagist.org/packages/rohanadhikari/nepali-date)[ GitHub Sponsors](https://github.com/rohanadhikari1)[ RSS](/packages/rohanadhikari-nepali-date/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (12)Versions (17)Used By (1)

NepaliDate — Bikram Sambat (BS) Date &amp; Time for PHP
=======================================================

[](#nepalidate--bikram-sambat-bs-date--time-for-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5f53548b4cdd5407aa1f0145484a54c6000b8994846035def154694a0e70c986/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f68616e616468696b6172692f6e6570616c692d646174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rohanadhikari/nepali-date)[![Total Downloads](https://camo.githubusercontent.com/744e17f68dada4b524a00cd8cdc7d2dcf3b51e87a8be7e691bd3842ee40e2acf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f68616e616468696b6172692f6e6570616c692d646174652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rohanadhikari/nepali-date)[![License: MIT](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](./LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/c33c30b996e81987991d3dfb5fb536265927404841cb3e36125300551baae610/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d3737376262342e7376673f7374796c653d666c61742d737175617265)](https://www.php.net/)

**NepaliDate** is a dependency-free PHP library for working with the **Nepali calendar (Bikram Sambat / BS)** — the calendar of Nepal. It converts between **AD (Gregorian) and BS**, formats, parses, compares, and manipulates Nepali dates with a fluent, [Carbon](https://carbon.nesbot.com/)-inspired API, and ships first-class **Laravel** support (Eloquent casts, validation rules, and Blade directives).

Whether you're building a Nepali government portal, a Nepal-based e-commerce app, a school/attendance system, or just need accurate **AD ⇄ BS date conversion** in PHP, NepaliDate gives you a complete, tested toolkit instead of hand-rolled conversion math.

---

✨ Features
----------

[](#-features)

- 🕒 Full **Nepali (BS) date and time** support — not just year/month/day conversion
- 🗓 Simple, accurate conversion **between AD and BS**
- 🔁 Both **mutable** (`NepaliDate`) and **immutable** (`NepaliDateImmutable`) variants
- ➕ Add, subtract, and snap dates by year, month, day, hour, minute, or second
- 🌐 Built-in **Nepali (`np`) and English (`en`) locales**, with full customization support
- 🔢 Format dates with `date()`-style tokens, or use predefined format constants
- 🔍 Rich comparison API — `isToday()`, `isWeekend()`, `between()`, and more
- 🧩 **Laravel-ready**: Eloquent casts, form validation rules, and Blade directives out of the box
- 🔤 Standalone `NepaliNumbers` utility for digit, currency, and word conversion

---

📦 Installation
--------------

[](#-installation)

Install via [Composer](https://getcomposer.org/):

```
composer require rohanadhikari/nepali-date
```

No other setup is required for plain PHP. In Laravel, the service provider is auto-discovered — see [Laravel Integration](./docs/LARAVEL.md).

---

🚀 Quick Start
-------------

[](#-quick-start)

```
use RohanAdhikari\NepaliDate\NepaliDate;
use RohanAdhikari\NepaliDate\NepaliDateImmutable;

// Current Nepali date and time
$now = NepaliDate::now();

// Parse a natural-language notation and manipulate it
$date = NepaliDate::fromNotation('tomorrow');
$date->addDays(5);

// Convert to Gregorian (AD)
$adDate = $date->toAd();

// Format it
echo $date->format(NepaliDate::FORMAT_DATETIME_24_FULL);
// e.g. 2082-06-30 14:45:22

// Immutable variant — every mutation returns a new instance
$immutableNow = NepaliDateImmutable::now();
$newDate = $immutableNow->addDays(10); // original is unchanged
```

Note

Predefined format constants are listed in [Constants](./docs/CONSTANTS.md).

### Using in plain PHP (no framework)

[](#using-in-plain-php-no-framework)

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

use RohanAdhikari\NepaliDate\NepaliDate;

$now = NepaliDate::now();
echo $now->format(NepaliDate::FORMAT_DATETIME_24_FULL);

$ad = new DateTime('now', new DateTimeZone('Asia/Kathmandu'));
echo NepaliDate::fromAd($ad)->format(NepaliDate::FORMAT_DATE_YMD);
```

Make sure the path to `vendor/autoload.php` is correct relative to your script — Composer is the recommended way to load the package.

---

📖 Documentation
---------------

[](#-documentation)

The core README covers the essentials; everything else lives in [`docs/`](./docs), organized by topic (Carbon-style) so you only read what you need:

GuideCovers[Initialization](./docs/INITIALIZATION.md)`now()`, `fromAd()`, `fromNotation()`, `fromTimestamp()`, direct construction[Formatting](./docs/FORMATTING.md)Format tokens, examples, locale-aware output[Parsing](./docs/PARSING.md)`parse()`, `createFromFormat()`, custom parse patterns[Arithmetic &amp; Shifting](./docs/ARITHMETIC.md)Add/subtract units, month overflow control, diff, timezone/week shifting[Getters](./docs/GETTERS.md)Year, time, day, month, timezone, and locale-based accessors[Setters](./docs/SETTERS.md)Basic, unit-based, and combined setters[Boundaries](./docs/BOUNDARIES.md)`startOf()`/`endOf()` for day, week, month, quarter, year, decade...[Comparison](./docs/COMPARISON.md)`eq()`, `between()`, `isToday()`, `isWeekend()`, and other state checks[Constants](./docs/CONSTANTS.md)Weekday, month, locale, and format constants[Locale Customization](./docs/LOCALECUSTOMIZE.md)Customizing month/weekday names per locale[Macros](./docs/MACRO.md)Adding custom methods at runtime[Nepali Numbers](./docs/NEPALINUMBERS.md)Digit, currency, and word conversion utilities[Calendar](./docs/CALENDER.md)Low-level BS/AD calendar math and lookup tables[Exceptions](./docs/EXCEPTIONS.md)What can be thrown, and how to guard against it[Laravel Integration](./docs/LARAVEL.md)Eloquent casts, validation rules, Blade directives---

🌐 Locale
--------

[](#-locale)

Available locales: `en` and `np`.

```
$date = NepaliDate::now();
$date->setLocale(NepaliDate::NEPALI); // or ->locale('np')

echo $date->format(NepaliDate::FORMAT_DATETIME_24);
// Example Output: २०८२-०६-३१ २१:३४

$date->resetLocale();
```

Note

Set a global default for every new instance with `NepaliDate::defaultLocale(NepaliDate::NEPALI)`. See [Locale Customization](./docs/LOCALECUSTOMIZE.md) to change the underlying month/weekday names.

---

Laravel Integration
-------------------

[](#laravel-integration)

Casts, form validation rules, and Blade directives (`@nepaliDate`, `@nepaliNow`, `@nepaliWeekend`, ...) are all included and auto-registered — see the [Laravel Integration Guide](./docs/LARAVEL.md) for the full reference.

```
use RohanAdhikari\NepaliDate\Laravel\Casts\ADAsNepaliDate;

class Post extends Model
{
    protected function casts(): array
    {
        return ['published_at' => ADAsNepaliDate::class];
    }
}
```

```
Published: @nepaliDate($post->published_at, 'l, F j, Y')
```

---

🧪 Testing
---------

[](#-testing)

```
composer test      # Run the Pest test suite
composer analyse    # Run PHPStan static analysis
composer format      # Run Laravel Pint
```

---

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome and will be fully credited. Please read the [Contributing Guide](./.github/CONTRIBUTING.md) before opening an issue or pull request.

🔒 Security
----------

[](#-security)

If you discover a security vulnerability, please see [SECURITY.md](./.github/SECURITY.md) for responsible disclosure instructions instead of using the public issue tracker.

📄 License
---------

[](#-license)

The MIT License (MIT). See [LICENSE.md](./LICENSE.md) for details.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance95

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

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 ~21 days

Recently: every ~4 days

Total

14

Last Release

25d ago

Major Versions

v0.0.9 → v1.0.02026-07-15

v1.0.2 → v2.0-beta2026-07-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/722e0f070daa642c9e8674712aa1dbefba22a6de0d27745f9fa9d1497b59ea29?d=identicon)[rohan123](/maintainers/rohan123)

---

Top Contributors

[![rohanAdhikari1](https://avatars.githubusercontent.com/u/82314325?v=4)](https://github.com/rohanAdhikari1 "rohanAdhikari1 (63 commits)")

---

Tags

laravellaravel-bslaravel-bs-datelaravel-nepali-datenepalinepali-calendarnepali-datenepali-date-conversionnepali-date-phpnepali-date-timenepali-datesnepali-timenepali-timezonephplaraveldatetimedatenepalnepali-datebikram-sambatbs-to-adad-to-bsNepali Calendarbs calendar

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[morilog/jalali

This Package helps developers to easily work with Jalali (Shamsi or Iranian) dates in PHP applications, based on Jalali (Shamsi) DateTime class.

9241.3M63](/packages/morilog-jalali)[hekmatinasser/verta

This Package helps developers to work with Jalali Datetime class for Laravel Framework PHP

663561.5k30](/packages/hekmatinasser-verta)[aloko/nova-persian-datepicker

Persian Datepicker for Laravel Nova.

203.7k](/packages/aloko-nova-persian-datepicker)[p3ym4n/jdate

Date converter from Jalali to Georgian and vice versa. It has Carbon instance inside and it's Laravel friendly.

101.8k2](/packages/p3ym4n-jdate)

PHPackages © 2026

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