PHPackages                             rakeshrai/laravel-nepali-date-converter - 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. rakeshrai/laravel-nepali-date-converter

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

rakeshrai/laravel-nepali-date-converter
=======================================

Laravel Nepali Date Converter is a package to convert English (AD) dates to Nepali (BS)

03PHPCI failing

Since Apr 20Pushed 1mo agoCompare

[ Source](https://github.com/myselfrakeshrai/laravel-nepali-date)[ Packagist](https://packagist.org/packages/rakeshrai/laravel-nepali-date-converter)[ RSS](/packages/rakeshrai-laravel-nepali-date-converter/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Neplai Date
===================

[](#laravel-neplai-date)

Author: Rakesh Rai

Convert English (AD) dates to Nepali (BS) in Laravel.

Features
--------

[](#features)

- AD -&gt; BS converter class
- `bs_date()` helper
- `LaravelNepaliDate` facade
- `@bs($date)` Blade directive
- Optional middleware to auto-convert AD date text in HTML responses

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

[](#installation)

```
composer require rakeshrai/laravel-nepali-date-converter
```

Publish config
--------------

[](#publish-config)

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

What To Do (Quick Start)
------------------------

[](#what-to-do-quick-start)

1. Install the package:

```
composer require rakeshrai/laravel-nepali-date-converter
```

2. Publish config:

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

3. Pick one preferred preset format:

- `bs_label_full`
- `bs_label_full_nepday`
- `bs_label_devanagari`
- `bs_label_compact`
- `bs_label_compact_time`
- `bs_datetime_numeric`

4. Start using helper in Blade/controller:

```
bs_date(now(), 'bs_label_compact');
```

5. If you already use old names (`bs_label_simp`, `bs_time`, `nepalilang`, etc.), no immediate changes are required. Legacy aliases still work.

Usage
-----

[](#usage)

### Helper

[](#helper)

```
bs_date('2026-04-20'); // 2083-01-07
bs_date(now(), 'Y/m/d');

// preferred preset labels
bs_date('2026-04-20 15:45:00', 'bs_label_full');          // monday 7, Baishak 2083
bs_date('2026-04-20 15:45:00', 'bs_label_full_nepday');   // sombar 7, Baishak 2083
bs_date('2026-04-20 15:45:00', 'bs_label_devanagari');    // सोमबार ७, बैशाख २०८३
bs_date('2026-04-20 15:45:00', 'bs_label_compact');       // 7, Baishak 2083
bs_date('2026-04-20 15:45:00', 'bs_label_compact_time');  // 7, Baishak 2083 03:45 PM
bs_date('2026-04-20 15:45:00', 'bs_datetime_numeric');    // 07-01-2083 03:45 PM
```

### Supported preset formats (preferred)

[](#supported-preset-formats-preferred)

- `bs_label_full` =&gt; `sunday 12, Baishak 2083`
- `bs_label_full_nepday` =&gt; `sombar 12, Baishak 2083`
- `bs_label_devanagari` =&gt; `सोमबार १२, बैशाख २०८३`
- `bs_label_compact` =&gt; `12, Baishak 2083`
- `bs_label_compact_time` =&gt; `12, Baishak 2083 hh:mm AM`
- `bs_datetime_numeric` =&gt; `12-01-2083 hh:mm AM`

### Legacy aliases (still supported)

[](#legacy-aliases-still-supported)

- `bs_label` =&gt; alias of `bs_label_full`
- `bs_label_nepday` =&gt; alias of `bs_label_full_nepday`
- `nepalilang` =&gt; alias of `bs_label_devanagari`
- `bs_label_simp` =&gt; alias of `bs_label_compact`
- `bs_label_time` =&gt; alias of `bs_label_compact_time`
- `bs_time` =&gt; alias of `bs_datetime_numeric`

### Custom format tokens

[](#custom-format-tokens)

- BS date: `Y`, `y`, `m`, `n`, `d`, `j`, `F`
- AD time/day passthrough: `l`, `H`, `h`, `i`, `s`, `A`

### Facade

[](#facade)

```
use LaravelNepaliDate;

LaravelNepaliDate::toString('2026-04-20');
LaravelNepaliDate::from('2026-04-20');
// [
//   'year' => 2083,
//   'month' => 1,
//   'day' => 7,
//   'month_name' => 'Baishak',
//   'week_day' => 'monday',
//   'time' => '12:00 AM',
//   'formatted' => '2083-01-07',
// ]
```

### Blade

[](#blade)

```
@bs($user->created_at)
```

### Auto-convert AD date strings in HTML output

[](#auto-convert-ad-date-strings-in-html-output)

In `config/nepali-date.php`:

```
'auto_convert_response_dates' => true,
```

This scans rendered HTML and converts patterns like:

- `2026-04-20`
- `2026/04/20`
- `2026.04.20`

If you do not want global auto registration in `web` group:

```
'auto_register_web_middleware' => false,
```

Then register manually in your app:

```
// app/Http/Kernel.php
protected $middlewareAliases = [
    // ...
    'auto.bs.date' => \RakeshRai\LaravelNepaliDate\Http\Middleware\AutoConvertAdDatesToBs::class,
];
```

Supported range
---------------

[](#supported-range)

- Minimum AD: `1943-04-14`
- Maximum depends on packaged BS data table (currently through BS 2099 data)

Notes
-----

[](#notes)

- Auto conversion is text pattern based. For precise control, prefer `bs_date()` or `@bs(...)` in Blade.
- For APIs/JSON, use explicit conversion in transformers/resources.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance59

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f791d8517c1509b147aa6909bc197d8028577f6a6a66f368c349191a831a7a6?d=identicon)[myselfrakeshrai](/maintainers/myselfrakeshrai)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[vovayatsyuk/magento2-alsoviewed

Product recommendations and suggestions. People who viewed this item also viewed. People with similar interests also viewed.

305.8k](/packages/vovayatsyuk-magento2-alsoviewed)[manners/widgets

A module for extended widget options in Magento 1.

142.0k](/packages/manners-widgets)

PHPackages © 2026

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