GithubHelp home page GithubHelp logo

subair-zufi / hijri_date Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ahmedoid/hijri_date

0.0 0.0 0.0 1.58 MB

Convert between Hijri Calendar and Gregorian Calendar date.

License: Other

Dart 100.00%

hijri_date's Introduction

Hijri

Hijri Calendar Converter

Usage

//Suppose current gregorian data/time is: Mon May 29 00:27:33  2018
  var _today = new HijriCalendar.now();
  print(_today.hYear); // 1439
  print(_today.hMonth); // 9
  print(_today.hDay); // 14
  print(_today.getDayName()); // 14
  // Get month length in days
  print(_today.lengthOfMonth); // 30 days
  print(_today.toFormat("MMMM dd yyyy")); //Ramadan 14 1439
Change Local
  HijriCalendar.setLocal(locale);
From Gregorian to Ummalqura
var h_date = new HijriCalendar.fromDate(new DateTime(2018, 11, 12));
print(h_date.toString()); //04/03/1440H
print(h_date.getShortMonthName()); //Rab1
print(h_date.getLongMonthName()); //Rabi' al-awwal
print(h_date.lengthOfMonth); // 29 days
Check if date is valid
  // 
  var _check_date = new HijriCalendar();
  _check_date.hYear = 1439;
  _check_date.hMonth = 11;
  _check_date.hDay = 30;
  print(_check_date.isValid()); // false -> This month is only 29 days
From Ummalqura to Gregorian
  //From Ummalqura to Gregorian
  var g_date = new HijriCalendar();
  print(g_date.hijriToGregorian(1415, 7, 27)); //1994-12-29 00:00:00.000
Format
  var _format = new HijriCalendar.now();
  print(_format.fullDate()); //Thulatha, Ramadan 14, 1439 h
  print(_format.toFormat("mm dd yy")); //09 14 39
Compare
  //Suppose current hijri data is: Thulatha, Ramadan 14, 1439 h
  print(_today.isAfter(1440, 11, 12)); // false
  print(_today.isBefore(1440, 11, 12)); // true
  print(_today.isAtSameMomentAs(1440, 11, 12)); // false
  

hijri_date's People

Contributors

aarif avatar ahmedoid avatar bilaalabdelhassan avatar yasser-alarifi 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.