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

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

jeeven/nepali-date-converter
============================

Nepali (BS) ↔ English (AD) Date Converter for Laravel — by Jeeven Lamichhane.

1.0.1(6mo ago)01.6k↓58.3%MITPHPPHP &gt;=8.0

Since Dec 5Pushed 6mo agoCompare

[ Source](https://github.com/MacAlistair1/Nepali-Date-Converter)[ Packagist](https://packagist.org/packages/jeeven/nepali-date-converter)[ Docs](https://github.com/MacAlistair1/Nepali-Date-Converter)[ RSS](/packages/jeeven-nepali-date-converter/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

🌗 Nepali Date Converter – Laravel Package
=========================================

[](#-nepali-date-converter--laravel-package)

A lightweight and framework-ready Laravel package for converting and working with Nepali Bikram Sambat (BS) dates and Gregorian (AD) dates using pure PHP.

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

[](#-features)

- 🔁 **BS ↔ AD Conversion**

    - Convert Nepali dates (BS) to Gregorian dates (AD)
    - Convert Gregorian dates (AD) to Nepali dates (BS)
- 🧪 **Date Validation**

    - Validate both BS and AD dates
    - Auto-normalization of date formats (YYYY/MM/DD, YYYY-MM-DD)
- 📅 **Date Formatting**

    - Format BS dates into Nepali or English
    - Supports PHP-like format patterns (`Y`, `m`, `d`, `F`, `l`)
    - Automatic Nepali digits, weekdays, and months
- 📆 **English Date Formatter**

    - Format AD dates in English or convert to Nepali digits &amp; names (`formattedEnglishDate()`)
- 🔠 **Nepali Digit Conversion**

    - Convert any number/string into Nepali digits (`toNepaliDigits()`)
- 📆 **Today's Date Helper**

    - Get today’s date in AD or BS with custom format (`today()`)
- 🔍 **Difference Between Two Dates**

    - Return difference in:
        - years
        - months
        - days
        - hours
        - minutes
        - seconds
    - Supports AD and BS dates (`diff()`)
- 📜 **Human-Readable Difference**

    - Human-friendly output (like Laravel’s `diffForHumans`)
    - English or Nepali output (`humanDiff()`)
- 📅 **Weekday Extraction**

    - Get weekday in English or Nepali from BS or AD date
- 🔢 **Day-of-Year Calculation**

    - Compute day number within BS year
- 📘 **Total Days in BS Year**

    - Retrieve total number of days in any BS year
- 🛠 **Laravel Compatible**

    - Works as a Laravel package or standalone in pure PHP

---

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

[](#-installation)

Install via Composer:

```
composer require jeeven/nepali-date-converter
```

Publish configuration (optional):

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

---

🚀 Usage
-------

[](#-usage)

### 1. Convert AD → BS

[](#1-convert-ad--bs)

```
use Jeeven\NepaliDateConverter\Facades\NepaliDate;

$bs = NepaliDate::adToBs("2026-07-29");
echo $bs; // "2083-04-14"

$bsDate = NepaliDate::adToBs("1999-07-29", true);
echo $bsDate->toNepaliFormat(); //२०५६/०४/१३
echo $bsDate->toNepaliHumanFormat(); //२०५६ श्रावण १३, बिहिवार
```

---

### 2. Convert BS → AD

[](#2-convert-bs--ad)

```
use Jeeven\NepaliDateConverter\Facades\NepaliDate;

$ad = NepaliDate::bsToAd("2083-04-14");
echo $ad; // "2026-07-29"
```

---

### 3. Validate AD Date

[](#3-validate-ad-date)

```
$isValid = NepaliDate::isValidADDate("2024-02-29");
var_dump($isValid); // false
```

---

### 4. Validate BS Date

[](#4-validate-bs-date)

```
$isValid = NepaliDate::isValidBSDate("2080-13-05");
var_dump($isValid); // false
```

---

### 5. Get Full AD Date Info

[](#5-get-full-ad-date-info)

```
$info = NepaliDate::getADInfo("2026-07-29");
print_r($info);

Output example:
[
  "adDate"     => "2026-07-29",
  "bsDate"     => "2083-04-14",
  "weekday"    => "Thursday",
  "dayOfYear"  => 111,
  "totalDays"  => 365,
  "diffDays"   => -300
]
```

---

### 6. Get Full BS Date Info

[](#6-get-full-bs-date-info)

```
$info = NepaliDate::getBSInfo("2083-04-14");
print_r($info);

Output example:
[
  "adDate"     => "2026-07-29",
  "bsDate"     => "2083-04-14",
  "weekday"    => "Thursday",
  "dayOfYear"  => 111,
  "totalDays"  => 365,
  "diffDays"   => -300
]
```

---

### 7. Get Weekday

[](#7-get-weekday)

```
NepaliDate::weekdayAD("2026-07-29"); // "Thursday"
NepaliDate::weekdayBS("2083-04-14"); // "Thursday"

NepaliDate::weekdayAD("2026-07-29", "np"); // "बिहिवार"
NepaliDate::weekdayBS("2083-04-14", "np"); // "बिहिवार"
```

---

### 8. Using the Facade

[](#8-using-the-facade)

```
use Jeeven\NepaliDateConverter\Facades\NepaliDate;

NepaliDate::adToBs("2024-01-01");
```

---

### 9. NepaliDate Utility Methods

[](#9-nepalidate-utility-methods)

1. `formattedNepaliDate($bsDate, $format = 'Y-m-d', $locale = 'en')`
--------------------------------------------------------------------

[](#1-formattednepalidatebsdate-format--y-m-d-locale--en)

This method is used to format a **BS (Nepali) date** into either **Nepali** or **English** formats. It supports custom date formats.

### Usage:

[](#usage)

```
echo NepaliDate::formattedEnglishDate("2025-12-03");
// 2025-12-03

echo NepaliDate::formattedEnglishDate("2025-12-03", "d/m/Y");
// 03/12/2025

echo NepaliDate::formattedEnglishDate("2025-12-03", "d F, l");
// 03 December, Wednesday

echo NepaliDate::formattedEnglishDate("2025-12-03", "d F, l", "np");
// १७ मंसिर, बुधवार

echo NepaliDate::formattedNepaliDate("2082/8/17");
// Default: 2082-08-17

echo NepaliDate::formattedNepaliDate("2082-08-17", "Y/m/d", "np");
// २०८२/०८/१७

echo NepaliDate::formattedNepaliDate("2082-08-17", "d F, l", "np");
// १७ मंसिर, बुधवार

echo NepaliDate::formattedNepaliDate("2082/08/17", "d/m/Y", "np");
// १७/०८/२०८२

// Get today's date in English (AD)
echo NepaliDate::today();
// Output: 2025-12-08 (example date)

// Custom format: English (AD)
echo NepaliDate::today("d/m/Y");
// Output: 08/12/2025

// Get today's date in Nepali (BS)
echo NepaliDate::today("d/m/Y", "np");
// Output: २२/०८/२०८२ (example BS date)

// Get full difference between two AD dates
print_r(NepaliDate::diff("2025-12-03", "2025-11-03"));
/*
Output:
[
    'years' => 0,
    'months' => 1,
    'days' => 30,
    'hours' => 720,
    'minutes' => 43200,
    'seconds' => 2592000
]
*/

// Get difference in specific units (days)
echo NepaliDate::diff("2025-12-03", "2025-11-03", 'en', 'days');
// Output: 30

// Get full difference between two BS dates
print_r(NepaliDate::diff("2082-08-17", "2082-08-10", "np"));
/*
Output:
[
    'years' => 0,
    'months' => 0,
    'days' => 7,
    'hours' => 168,
    'minutes' => 10080,
    'seconds' => 604800
]
*/

// Get difference in specific units (months)
echo NepaliDate::diff("2082-08-17", "2082-01-01", "np", "months");
// Output: 7

// Get human-readable difference in English (AD)
echo NepaliDate::humanDiff("2025-01-01", "2023-12-01");
// Output: "1 year, 1 month, 0 days"

// Get human-readable difference in Nepali (BS)
echo NepaliDate::humanDiff("2082-08-17", "2081-01-10", "np", "np");
// Output: "१ वर्ष, ७ महिना, ७ दिन"

// Get human-readable difference in English (AD) without years or months
echo NepaliDate::humanDiff("2025-01-01", "2025-01-10");
// Output: "9 days"

// Get human-readable difference in Nepali (BS) without years or months
echo NepaliDate::humanDiff("2082-08-17", "2082-08-10", "np", "np");
// Output: "७ दिन"

$number = 1234567;
echo NepaliDate::toNepaliDigits($number);
// Output: १२३४५६७
```

---

⚙️ Configuration (Optional)
---------------------------

[](#️-configuration-optional)

File: config/nepali-date.php

```
return [
    "start_year" => 1970,
    "end_year"   => 2090
];
```

---

🧪 Testing
---------

[](#-testing)

```
php artisan test
```

---

📝 License
---------

[](#-license)

This package is open-source and available under the MIT License.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance66

Regular maintenance activity

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Total

2

Last Release

207d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3854d82e7a8c8c4e428f8eda7ac382855c84fbc5035f9fb6190212939a4e7e93?d=identicon)[jeeven](/maintainers/jeeven)

---

Top Contributors

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

---

Tags

laravelenglishnepali-datenepalidate-converterBikramsambatjeevenadtobs

### Embed Badge

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

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

PHPackages © 2026

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