提供具有中国特色的休假安排或者工作日查询。
Add this line to your application's Gemfile:
gem 'chinese-holidays'
And then execute:
$ bundle
Or install it yourself as:
$ gem install chinese-holidays
元旦 = Date.new(2016, 1, 1)
# 是否休假(含正常的周六、周日)
Chinese::Holidays.is_holiday?(元旦) # true
# 是否是工作日(含节假日的调休)
Chinese::Holidays.is_workdingday?(元旦) # fase
# 列出已知的特殊节假日
Chinese::Holidays.all.each do |holiday|
puts "#{holiday.name} #{holiday.days.map {|date| date.strftime('%F')}}"
end
# 元旦 ["2016-01-01", "2016-01-02", "2016-01-03"]
# ...
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/chinese-holidays. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.