定制 pratiksh/nepalidate 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

pratiksh/nepalidate

最新稳定版本:v2.0.1

Composer 安装命令:

composer require pratiksh/nepalidate

包简介

Laravel package to convert AD to BS that can work with carbon.

README 文档

README

Laravel Nepali Date Converter

Latest Version on PackagistStars Downloads Build Status Scrutinizer Code Quality CodeFactor Larastan License

Laravel package to convert AD to BS that can work with carbon.

Installation

You can install the package via composer:

composer require pratiksh/nepalidate

Usages

By Using Converter Classes.

AD to BS

use Pratiksh\Nepalidate\Services\NepaliDate;

NepaliDate::create(\Carbon\Carbon::now())->toBS(); // 2082-02-04
NepaliDate::create(\Carbon\Carbon::now())->toFormattedEnglishBSDate(); // 4 Jestha 2082, Sunday
NepaliDate::create(\Carbon\Carbon::now())->toFormattedNepaliBSDate(); // ४ जेठ २०८२, आइतवार

By Using Helper Function.

toBS(\Carbon\Carbon::now()); // 2082-02-04
toFormattedEnglishBSDate(\Carbon\Carbon::now()); // 4 Jestha 2082, Sunday
toFormattedNepaliBSDate(\Carbon\Carbon::now()); // ४ जेठ २०८२, आइतवार
toDetailBS(\Carbon\Carbon::now()); // {
    "year": 2082,
    "month": "02",
    "day": "04",
    "dayOfWeek": 1,
  }

BS to AD

use Pratiksh\Nepalidate\Services\EnglishDate;
EnglishDate::create("2082-02-04")->toAD(); //2025-05-18
EnglishDate::create("2082-02-04")->toAD('Y-m-d g:i A'); // 2025-05-18 12:00 AM
EnglishDate::create("2082-02-04")->toCarbon(); // To Carbon instance
EnglishDate::create("2082-02-04")->date; // Carbon instance

By Using Helper Functions

toAD("2082-02-04"); // Carbon instance

Upgrade Guide

This new version include major updates that could break the code.

  • toFormattedBSDate(Carbon $date) changed to toFormattedEnglishBSDate(Carbon $date)
  • toFormattedNepaliDate(Carbon $date) changed to toFormattedNepaliBSDate(Carbon $date)
  • Facades are removed.

Testing

./vendor/bin/pest

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email pratikdai404@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 5.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 26
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 26
  • Watchers: 1
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-08-05