A Ruby gem for generating Nepali Calendar (Bikram Sambat Calendar). You can also convert dates between BS and AD. Nepali Calendar is based on the API from codeartsnepal.
Add this line to your application's Gemfile:
gem 'nepali_calendar'
And then execute:
$ bundle
Or install it yourself as:
$ gem install nepali_calendar
bs_cal = NepaliCalendar::BsCalendar.ad_to_bs('2024', '09', '10')
=> Mangalbar, 25 Bhadra, 2081
bs_cal.year
=> 2081
bs_cal.month
=> 5
bs_cal.month_name
=> "Bhadra"
bs_cal.wday
=> 3
bs_cal.wday_name
=> "Mangalbar"
bs_cal.day
=> 25
bs_cal.to_s
=> "2081-05-25"
bs_cal.beginning_of_month
=> Sanibar, 1 Bhadra, 2081
bs_cal.beginning_of_week
=> Aitabar, 23 Bhadra, 2081
bs_cal.end_of_month
=> Sombar, 31 Bhadra, 2081
bs_cal.end_of_week
=> Sanibar, 29 Bhadra, 2081
ad_cal = NepaliCalendar::AdCalendar.bs_to_ad('2072', '05', '24')
=> Thursday, 10 September, 2015
ad_cal.to_s
=> "2015-09-10"
Convert to Ruby date object
ad_cal.to_s.to_date
=> Thu, 10 Sep 2015
- Fork it ( https://github.com/lalusaud/nepali_calendar/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request