hijri 0.0.13

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 18

Hijri

Umm Alqura Hijri Calendar Converter

Usage

//Suppose current gregorian data/time is: Mon May 29 00:27:33  2018
  var _today = new ummAlquraCalendar.now();
  print(_today.hYear); // 1439
  print(_today.hMonth); // 9
  print(_today.hDay); // 14
  print(_today.hDay); // 14
  // Get month length in days
  print(_today.lengthOfMonth); // 30 days
  print(_today.toFormat("MMMM dd yyyy")); //Ramadan 14 1439
From Gregorian to Ummalqura
  var h_date = new ummAlquraCalendar.fromDate(new DateTime(2018, 11, 12));
  print(h_date.toString()); //04/03/1440H
  print(h_date.shortMonthName); //Rab1
  print(h_date.longMonthName); //Rabi' al-awwal
  print(h_date.lengthOfMonth); // 29 days
check date is valid
  // 
  var _check_date = new ummAlquraCalendar();
  _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 ummAlquraCalendar();
  print(g_date.hijriToGregorian(1439, 12, 11)); //2018-08-22 00:00:00.000
Format
  var _format = new ummAlquraCalendar.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
  

Changelog

0.0.1

  • Initial version

example/main.dart

import 'package:hijri/umm_alqura_calendar.dart';

void main() {
  //Suppose current gregorian data/time is: Mon May 29 00:27:33  2018
  ummAlquraCalendar _today = new ummAlquraCalendar.now();
  _today.currentLocale = 'ar';
  print(_today.hYear); // 1439
  print(_today.hMonth); // 9
  print(_today.hDay); // 14
  print(_today.hDay); // 14
  // Get month length in days
  print(_today.lengthOfMonth); // 30 days
  print(_today.toFormat("MMMM dd yyyy")); //Ramadan 14 1439
  print(" 10 months from now ${new ummAlquraCalendar.addMonth(1439, 12)
      .toString()}"); //Ramadan 14 1439

  //From Gregorian to Ummalqura
  var h_date = new ummAlquraCalendar.fromDate(new DateTime(2018, 11, 12));

  print(h_date.toString()); //04/03/1440H
  print(h_date.shortMonthName); //Rab1
  print(h_date.longMonthName); //Rabi' al-awwal
  print(h_date.lengthOfMonth); // 29 days

  // check date is valid
  var _check_date = new ummAlquraCalendar()
    ..hYear = 1430
    ..hMonth = 09
    ..hDay = 8
    ..currentLocale = 'ar';
  print(_check_date.isValid()); // false -> This month is only 29 days
  print(_check_date.fullDate()); // false -> This month is only 29 days

  //From Ummalqura to Gregorian
  var g_date = new ummAlquraCalendar();
  print(g_date.hijriToGregorian(1439, 12, 11)); //2018-08-22 00:00:00.000

  //Format
  var _format = new ummAlquraCalendar.now()..currentLocale = 'ar';
  ;
  print(_format.fullDate()); //Thulatha, Ramadan 14, 1439 h
  print(_format.toFormat("mm dd yy")); //09 14 39
  print(_format.toFormat("-- DD, MM dd --")); //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
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  hijri: ^0.0.13

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:hijri/umm_alqura_calendar.dart';
import 'package:hijri/umm_alqura_array.dart';
  
Version Uploaded Documentation Archive
0.0.13 Jun 3, 2018 Go to the documentation of hijri 0.0.13 Download hijri 0.0.13 archive
0.0.12 Jun 3, 2018 Go to the documentation of hijri 0.0.12 Download hijri 0.0.12 archive
0.0.11 Jun 3, 2018 Go to the documentation of hijri 0.0.11 Download hijri 0.0.11 archive
0.0.10 Jun 3, 2018 Go to the documentation of hijri 0.0.10 Download hijri 0.0.10 archive
0.0.9 Jun 2, 2018 Go to the documentation of hijri 0.0.9 Download hijri 0.0.9 archive
0.0.8 Jun 2, 2018 Go to the documentation of hijri 0.0.8 Download hijri 0.0.8 archive
0.0.7 Jun 2, 2018 Go to the documentation of hijri 0.0.7 Download hijri 0.0.7 archive
0.0.6 Jun 2, 2018 Go to the documentation of hijri 0.0.6 Download hijri 0.0.6 archive
0.0.5 Jun 2, 2018 Go to the documentation of hijri 0.0.5 Download hijri 0.0.5 archive
0.0.4 May 29, 2018 Go to the documentation of hijri 0.0.4 Download hijri 0.0.4 archive

All 13 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
35
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
18
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <=2.0.0-dev.58.0