Giter VIP home page Giter VIP logo

elixir-jalaali's Introduction

Elixir Jalaali calendar

Build Status Hex.pm GitHub license GitHub issues

Elixir implementation of jalaali.js which contains a Calendar implementation for jalaali and some functions for converting Jalaali and Gregorian calendar systems to each other.

Installation

You can install jalaali by Addding it to your list of dependencies in mix.exs:

def deps do
  [
    {:jalaali, "~> 0.4"}
  ]
end

Usage

After installing jalaali package. you can create Dates/DateTimes in jalaali or convert Dates/DateTimes form other calendars back an forth.

How to use

  • Creating new Date
  Date.new(1396, 6, 30, Jalaali.Calendar)
  {:ok, %Date{calendar: Jalaali.Calendar, day: 30, month: 6, year: 1396}}
  • Converting a DateTime to Jalaali
  datetime_in_any_calendar = DateTime.utc_now(Calendar.ISO)
  {:ok, jalaali_datetime} = DateTime.convert(datetime_in_any_calendar, Jalaali.Calendar)
  • Converting a DateTime from Jalaali
  jalaali_datetime = DateTime.utc_now(Jalaali.Calendar)
  {:ok, iso_datetime} = DateTime.convert(jalaali_datetime, Calendar.ISO)
  • Converting a Date to Jalaali
  date_in_any_calendar = Date.new(2017, 1, 1, Calendar.ISO)
  {:ok, jalaali_date} = Date.convert(date_in_any_calendar, Jalaali.Calendar)
  • Converting a Date from Jalaali
  {:ok, jalaali_date} = Date.new(1396, 6, 30, Jalaali.Calendar)
  {:ok, iso_date} = Date.convert(jalaali_date, Calendar.ISO)

Thats super easy. :)

License

This project is license under MIT.

For more information please check LICENSE

elixir-jalaali's People

Contributors

alisinabh avatar shahryarjb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.