All Projects → ecleel → hijri

ecleel / hijri

Licence: MIT license
Hijri date library for Ruby

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to hijri

tinify-ruby
Ruby client for the Tinify API.
Stars: ✭ 41 (-26.79%)
Mutual labels:  gem
runfile
Command line for your projects
Stars: ✭ 22 (-60.71%)
Mutual labels:  gem
click house
Modern Ruby database driver for ClickHouse
Stars: ✭ 133 (+137.5%)
Mutual labels:  gem
nagios check
Ruby Nagios Check Integration
Stars: ✭ 13 (-76.79%)
Mutual labels:  gem
go-prettytime
Format GoLang dates in a “pretty” way. ex : just now, a minute ago, 2 hours ago , 3 minutes ago
Stars: ✭ 23 (-58.93%)
Mutual labels:  date
TimesDates.jl
Nanosecond resolution for Time and Date, TimeZones
Stars: ✭ 28 (-50%)
Mutual labels:  date
lockup
Lockup Gem
Stars: ✭ 111 (+98.21%)
Mutual labels:  gem
reproducible-continual-learning
Continual learning baselines and strategies from popular papers, using Avalanche. We include EWC, SI, GEM, AGEM, LwF, iCarl, GDumb, and other strategies.
Stars: ✭ 118 (+110.71%)
Mutual labels:  gem
elm-date-extra
Extra functions for working with Date
Stars: ✭ 41 (-26.79%)
Mutual labels:  date
nepcal
Robust, highly tested, cross-platform library and command-line utilities for Nepali dates
Stars: ✭ 37 (-33.93%)
Mutual labels:  date
fcmpush
Firebase Cloud Messaging API wrapper for Ruby, suppot HTTP v1 API including access_token auto refresh feature.
Stars: ✭ 44 (-21.43%)
Mutual labels:  gem
kronos
Management of arithmetic operations on dates
Stars: ✭ 23 (-58.93%)
Mutual labels:  date
warm-blanket
Ruby gem for warming up web services on boot
Stars: ✭ 1 (-98.21%)
Mutual labels:  gem
temps-lite
A smart, good-looking little app which tries to speak your language the way you are used to.
Stars: ✭ 40 (-28.57%)
Mutual labels:  date
OpenSondage
Fork de STUdS
Stars: ✭ 68 (+21.43%)
Mutual labels:  date
git-reclone
reclone your git repo
Stars: ✭ 11 (-80.36%)
Mutual labels:  gem
socket.io-rails
Rails asset pipeline wrapper for socket.io
Stars: ✭ 57 (+1.79%)
Mutual labels:  gem
ssrf filter
A ruby gem for defending against Server Side Request Forgery (SSRF) attacks
Stars: ✭ 68 (+21.43%)
Mutual labels:  gem
island-time
A Kotlin Multiplatform library for working with dates and times
Stars: ✭ 69 (+23.21%)
Mutual labels:  date
react-native-date-ranges
idea from react-native-dates >
Stars: ✭ 68 (+21.43%)
Mutual labels:  date

Hijri

Gem Version Build Status Join the chat at https://gitter.im/ecleel/hijri

Hijri Date library for Ruby.

hijri is full lunar Islamic Hijri calendar lib for ruby.

Hijri Calendar (from Wikipedia)

The Islamic calendar or Muslim calendar or Hijri calendar: is a lunar calendar consisting of 12 lunar months in a year of 354 or 355 days. It is used to date events in many Muslim countries (concurrently with the Gregorian calendar), and used by Muslims everywhere to determine the proper day on which to celebrate Islamic holy days and festivals. The first year was the year during which the emigration of the Islamic prophet Muhammad from Mecca to Medina, known as the Hijra, occurred. Each numbered year is designated either H for Hijra or AH for the Latin anno Hegirae (in the year of the Hijra).[1] A limited number of years before Hijra (BH) are used to date events related to Islam, such as the birth of Muhammad in 53 BH.[2] The current Islamic year is 1431 AH, from approximately 18 December 2009 (evening) to 6 December 2010 (evening).

http://en.wikipedia.org/wiki/Islamic_calendar

Installation

Add this line to your application's Gemfile:

gem 'hijri'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hijri

Usage

require 'hijri'

# you can create hijri date from stdlib Date class.
h = Date.today.to_hijri # => #<Hijri::Date:0x007f875e8c84e8 @year=1436, @month=2, @day=16>

# or you can initialize new one.
hijri = Hijri::Date.new 1430, 1, 3 # => #<Hijri::Date:0x007f875e8dbb38 @year=1430, @month=1, @day=3>

# or you can get today hijri date directly.
today = Hijri::Date.today # => #<Hijri::Date:0x007f875e8d8410 @year=1436, @month=2, @day=16>

# and you can convert hijri date to greogian date also.
hijri.to_greo # => #<Date: 2009-01-01 ((2454833j,0s,0n),+0s,2299161j)>

# and there is DateTime too
date_and_time = Hijri::DateTime.now # => #<Hijri::DateTime:0x007f875e8eac00 @year=1436, @month=2, @day=16, @hour=14, @minute=14, @second=39, @zone="+03:00">

# hijri support strftime method with the same options as Greogian date format method
Hijri::DateTime.now.strftime('%c') # => "Ahad Rabia I 20 16:00:25 1436"

Supported Ruby versions

This library aims to support and is tested against the following Ruby implementations:

  • MRI 1.8.7
  • MRI 1.9.2
  • MRI 1.9.3
  • MRI 2.0.0
  • MRI 2.1.0
  • MRI 2.2.0
  • MRI 2.3.0
  • MRI 2.4.0
  • MRI 2.4.1
  • MRI 2.5.1
  • MRI 2.6.2
  • JRuby 1.8 mode
  • JRuby 1.9 mode

If something doesn't work on one of these Ruby versions, it's a bug.

This library may inadvertently work (or seem to work) on other Ruby implementations, however support will only be provided for the versions listed above.

If you would like this library to support another Ruby version, you may volunteer to be a maintainer. Being a maintainer entails making sure all tests run and pass on that implementation. When something breaks on your implementation, you will be responsible for providing patches in a timely fashion. If critical issues for a particular implementation exist at the time of a major release, support for that Ruby version may be dropped.

TODO

  • Add Hijri::Date and Hijri::DateTime.
  • Accept test error with one day range.
  • Add Hijri::DateTime.now to create Hijri::DateTime object.
  • Add Hijri::Date.today to create Hijri::Date object with today date.
  • Add Comparable for Hijri::Date.
  • Implement strftime method.
  • Add Hijri::Date.change method.
  • Raise ArgumentError when one of arguments has an invalid date value.
  • Implement Hijri::Date.strptime method.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].