sagartimilsina / nepali-date
Convert dates between Bikram Sambat (BS) and Gregorian (AD), with English and Nepali (Devanagari) input support, for PHP and Laravel.
Package info
github.com/timilsinasagar/Nepali-Date-Converter-Package
pkg:composer/sagartimilsina/nepali-date
No longer found in upstream repository
Requires
- php: ^8.2
- illuminate/support: ^9.0|^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^8.0
- phpunit/phpunit: ^10.0
README
A lightweight, accurate, and developer-friendly PHP package for converting dates between Bikram Sambat (BS) and Gregorian (AD).
Supports both Laravel and plain PHP applications.
Features
- ✅ Convert BS → AD
- ✅ Convert AD → BS
- ✅ Accepts English and Nepali (Devanagari) numerals
- ✅ Format dates in English or Nepali
- ✅ Day of week support
- ✅ Month name support
- ✅ Laravel Auto Discovery
- ✅ Zero external API dependency
- ✅ Fast and lightweight
- ✅ PHP 8.2+
Requirements
- PHP 8.2+
- Laravel 9, 10, 11, 12, 13 (optional)
Installation
Install via Composer.
composer require sagartimilsina/nepali-date
Laravel will automatically discover the service provider.
Basic Usage
use Sagartimilsina\NepaliDate\Facades\NepaliDate;
BS to AD
$result = NepaliDate::bsToAd('2083-03-24'); echo $result;
Output
2026-07-08
AD to BS
$result = NepaliDate::adToBs('2026-07-08'); echo $result;
Output
2083-03-24
Nepali Number Input
The package accepts Nepali digits.
NepaliDate::bsToAd('२०८३-०३-२४');
Nepali Output
NepaliDate::adToBs( '2026-07-08', language: 'np' );
Output
२०८३-०३-२४
Get Month Name
NepaliDate::monthName(3);
Output
Ashadh
Nepali
NepaliDate::monthName(3, 'np');
Output
असार
Get Day Name
NepaliDate::dayName('2026-07-08');
Output
Wednesday
Nepali
NepaliDate::dayName('2026-07-08', 'np');
Output
बुधबार
Format Date
NepaliDate::format( '2083-03-24', language: 'en' );
Output
24 Ashadh 2083
Nepali
NepaliDate::format( '2083-03-24', language: 'np' );
Output
२४ असार २०८३
Plain PHP Usage
require 'vendor/autoload.php'; use Sagartimilsina\NepaliDate\NepaliDate; $date = new NepaliDate(); echo $date->bsToAd('2083-03-24');
Supported Years
| Calendar | Supported Years |
|---|---|
| BS | 2000 – 2100 |
| AD | 1943 – 2044 |
Example
use Sagartimilsina\NepaliDate\Facades\NepaliDate; echo NepaliDate::adToBs('2026-07-08'); echo NepaliDate::bsToAd('2083-03-24');
Testing
composer test
or
vendor/bin/phpunit
Contributing
Contributions are welcome.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push the branch
- Open a Pull Request
Roadmap
- BS → AD Conversion
- AD → BS Conversion
- Nepali Number Support
- Laravel Integration
- Carbon Integration
- Date Validation Helpers
- Blade Components
- Localization Improvements
License
This package is open-sourced software licensed under the MIT License.
Author
Sagar Timilsina
Laravel & Full Stack Developer
GitHub
https://github.com/timilsinasagar
Packagist
https://packagist.org/packages/sagartimilsina/nepali-date
If this package helps you, please consider giving it a ⭐ on GitHub.