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

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

sarojsardar/laravel-nepali-date
===============================

Laravel Nepali Date Converter Package

v1.0.1(5mo ago)01MITPHPPHP ^8.0|^8.1|^8.2|^8.3|^8.4

Since Jan 20Pushed 5mo agoCompare

[ Source](https://github.com/sarojsardar/Laravel-Nepali-Date)[ Packagist](https://packagist.org/packages/sarojsardar/laravel-nepali-date)[ RSS](/packages/sarojsardar-laravel-nepali-date/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

Laravel Nepali Date Converter (Laravel 12+ Compatible)
======================================================

[](#laravel-nepali-date-converter-laravel-12-compatible)

[![Latest Version](https://camo.githubusercontent.com/34e695c6016bc2a934a96bed696e29b2f2ab562a7134d65a55d00653cd506bea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e737667)](https://github.com/sarojsardar/laravel-nepali-date)[![PHP Version](https://camo.githubusercontent.com/6dbd9f3a171b2fff8f351f0245de1e1b067f1e271d494394af7d9e22b55557bb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e302532422d627269676874677265656e2e737667)](https://php.net)[![Laravel Version](https://camo.githubusercontent.com/7a4bce07ca4b4d5250b93b10d34351bdf917b9199defe99775d82d3805e053cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d392532422d7265642e737667)](https://laravel.com)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

A comprehensive Laravel package for converting English (Gregorian) dates to Nepali (Bikram Sambat) dates with full localization support.

🌟 Features
----------

[](#-features)

- ✅ **Accurate Date Conversion** - English to Nepali date conversion
- ✅ **Extended Year Support** - Supports years 2000-2100 BS (1943-2043 AD)
- ✅ **Multiple Date Formats** - Flexible formatting options
- ✅ **Dual Numeral System** - Nepali (देवनागरी) and English numerals
- ✅ **Localized Month Names** - Both Nepali and English month names
- ✅ **Day Names** - Full day names in Nepali
- ✅ **Timezone Support** - Asia/Kathmandu timezone
- ✅ **Error Handling** - Comprehensive validation and error handling
- ✅ **Laravel Integration** - Facade, Service Provider, and Helper functions
- ✅ **Modern PHP** - PHP 8.0+ with strict typing
- ✅ **Laravel Compatibility** - Laravel 9, 10, 11, 12 support

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

[](#-installation)

Install the package via Composer:

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

The package will automatically register its service provider and facade.

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

[](#-quick-start)

### Basic Usage

[](#basic-usage)

```
// Convert today's date to Nepali
echo toNepaliDate(now()->format('Y-m-d'));
// Output: २०८१-०८-१५

// Convert specific date
echo toNepaliDate('2024-12-01');
// Output: २०८१-०८-१५
```

📖 Usage Guide
-------------

[](#-usage-guide)

### Helper Functions

[](#helper-functions)

#### `toNepaliDate()`

[](#tonepalidate)

Convert English date to Nepali date with custom formatting:

```
// Basic conversion
echo toNepaliDate('2024-01-15');
// Output: २०८०-१०-०१

// Custom format with month name
echo toNepaliDate('2024-01-15', 'Y F d');
// Output: २०८० पुष ०१

// With day name
echo toNepaliDate('2024-01-15', 'Y F d, l');
// Output: २०८० पुष ०१, सोमवार

// English numerals
echo toNepaliDate('2024-01-15', 'Y-m-d', false);
// Output: 2080-10-01
```

#### `nepaliToday()`

[](#nepalitoday)

Get today's date in Nepali:

```
echo nepaliToday();
// Output: २०८१-०८-१५

echo nepaliToday('Y F d, l');
// Output: २०८१ कार्तिक १५, आइतवार
```

#### `nepaliDateArray()`

[](#nepalidatearray)

Get Nepali date as an array:

```
$date = nepaliDateArray('2024-01-15');
/*
Output:
[
    'year' => 2080,
    'month' => 10,
    'day' => 1,
    'month_name_nepali' => 'पुष',
    'month_name_english' => 'Poush',
    'day_name' => 'सोमवार'
]
*/
```

### Class Methods

[](#class-methods)

```
use SarojSardar\LaravelNepaliDate\NepaliDate;

// Convert date
$nepaliDate = NepaliDate::convertToNepali('2024-01-15');

// Format date
echo NepaliDate::format('2024-01-15', 'Y F d l');
// Output: २०८० पुष ०१ सोमवार

// Today's date
echo NepaliDate::today('Y-m-d');
// Output: २०८१-०८-१५

// Check if year is supported
if (NepaliDate::isValidNepaliYear(2080)) {
    echo "Year 2080 is supported";
}

// Get supported year range
$range = NepaliDate::getSupportedYearRange();
// Output: ['min' => 2000, 'max' => 2100]
```

### Facade Usage

[](#facade-usage)

```
use SarojSardar\LaravelNepaliDate\Facades\NepaliDate;

// All class methods available through facade
echo NepaliDate::format('2024-01-15', 'Y F d');
echo NepaliDate::today();
$range = NepaliDate::getSupportedYearRange();
```

### Blade Templates

[](#blade-templates)

```
{{-- In your Blade templates --}}
Date: {{ toNepaliDate($post->created_at->format('Y-m-d'), 'Y F d') }}
Today: {{ nepaliToday('Y F d, l') }}

{{-- With calendar icon --}}

    {{ toNepaliDate($news->published_at->format('Y-m-d')) }}

```

🎨 Format Options
----------------

[](#-format-options)

FormatDescriptionExample Output`Y`4-digit year२०८०`m`Month (01-12)१०`d`Day (01-32)०१`F`Full month name (Nepali)पुष`M`Full month name (English)Poush`l`Day name (Nepali)सोमवार### Format Examples

[](#format-examples)

```
$date = '2024-01-15';

echo toNepaliDate($date, 'Y-m-d');        // २०८०-१०-०१
echo toNepaliDate($date, 'Y F d');        // २०८० पुष ०१
echo toNepaliDate($date, 'Y M d');        // २०८० Poush ०१
echo toNepaliDate($date, 'd F Y');        // ०१ पुष २०८०
echo toNepaliDate($date, 'l, d F Y');     // सोमवार, ०१ पुष २०८०
echo toNepaliDate($date, 'Y/m/d');        // २०८०/१०/०१
```

🌍 Localization
--------------

[](#-localization)

### Nepali Months

[](#nepali-months)

- वैशाख (Baisakh)
- जेठ (Jestha)
- असार (Ashar)
- साउन (Shrawan)
- भदौ (Bhadra)
- असोज (Ashoj)
- कार्तिक (Kartik)
- मंसिर (Mangsir)
- पुष (Poush)
- माघ (Magh)
- फागुन (Falgun)
- चैत (Chaitra)

### Nepali Days

[](#nepali-days)

- आइतवार (Sunday)
- सोमवार (Monday)
- मङ्गलवार (Tuesday)
- बुधवार (Wednesday)
- बिहिवार (Thursday)
- शुक्रवार (Friday)
- शनिवार (Saturday)

⚠️ Error Handling
-----------------

[](#️-error-handling)

The package throws `InvalidArgumentException` for:

```
try {
    echo toNepaliDate('invalid-date');
} catch (InvalidArgumentException $e) {
    echo "Error: " . $e->getMessage();
}

// Common error scenarios:
// - Invalid date format: "Invalid date format: invalid-date"
// - Date out of range: "Date out of supported range"
```

📅 Supported Date Range
----------------------

[](#-supported-date-range)

- **Nepali Years**: 2000 BS - 2100 BS
- **English Years**: 1943 AD - 2043 AD
- **Reference Date**: 1943-04-14 AD = 2000-01-01 BS

🔧 Advanced Usage
----------------

[](#-advanced-usage)

### Custom Service Provider

[](#custom-service-provider)

If you need to customize the package behavior:

```
// In your AppServiceProvider
public function boot()
{
    // Custom logic here
}
```

### Configuration

[](#configuration)

The package works out of the box with sensible defaults:

- Timezone: Asia/Kathmandu
- Default format: Y-m-d
- Nepali numerals: Enabled by default

🧪 Testing
---------

[](#-testing)

```
// Test basic conversion
$result = toNepaliDate('2024-01-15');
assert($result === '२०८०-१०-०१');

// Test format options
$result = toNepaliDate('2024-01-15', 'Y F d');
assert($result === '२०८० पुष ०१');

// Test English numerals
$result = toNepaliDate('2024-01-15', 'Y-m-d', false);
assert($result === '2080-10-01');
```

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

[](#-contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

📄 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

👨‍💻 Author
----------

[](#‍-author)

**Saroj Sardar**

- Email:
- GitHub: [@sarojsardar](https://github.com/sarojsardar)

🙏 Acknowledgments
-----------------

[](#-acknowledgments)

- Thanks to the Laravel community
- Nepali calendar data sources
- Contributors and testers

---

**Made with ❤️ for the Nepali developer community**

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance71

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

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

Total

2

Last Release

162d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/108754250?v=4)[Saroj Sardar](/maintainers/sarojsardar)[@sarojsardar](https://github.com/sarojsardar)

---

Top Contributors

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

---

Tags

laravelconverterdatenepalibikramsambat

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k12.5k1](/packages/vinkius-labs-laravel-page-speed)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90142.9k](/packages/emargareten-inertia-modal)[wearepixel/laravel-cart

A cart implementation for Laravel

1374.8k](/packages/wearepixel-laravel-cart)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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