Project

vncalendar

0.0
No release in over 3 years
Low commit activity in last 3 years
Vietnamese date converter. A Ruby port of https://github.com/vanng822/vncalendar in Golang
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 5.0
~> 10.0
 Project Readme

Vncalendar

Build Status Gem Version

Installation

Add this line to your application's Gemfile:

gem 'vncalendar'

And then execute:

$ bundle

Or install it yourself as:

$ gem install vncalendar

Usage

  • Convert solar date or Gregorian date - our regular date, to lunar date:
UTC_OFFSET = 7 # Asian/Ho_Chi_Minh
Vncalendar::Converter.solar_to_lunar(Date.new(2014, 9, 23), UTC_OFFSET)
  • Convert lunar date to solar date:
UTC_OFFSET = 7 # Asian/Ho_Chi_Minh
LEAP_MONTH_OF_THE_YEAR = 0 # no leap month in this year.
Vncalendar::Converter.lunar_to_solar(Date.new(2014, 8, 30), LEAP_MONTH_OF_THE_YEAR, UTC_OFFSET)

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

You can run one of these commands to run the test suite:

rake test

# Or:
ruby -Ilib:test test/*

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kidlab/vncalendar.

Credit

This code is ported from this repo https://github.com/vanng822/vncalendar - by Nguyen Van Nhu (@vanng822), which is originally based on the Algorithms for computing lunar calendar (Vietnamese version) by Ho Ngoc Duc.

License

The gem is available as open source under the terms of the MIT License.