hijri 0.2.5

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

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(1415, 7, 27)); //1994-12-29 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.2.1 #

  • Update sdk to Dart 2.0

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
  print(_today.dayWeName);
  // 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(1440, 12)
      .fullDate()}"); //Ramadan 14 1439

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

  print(h_date.fullDate()); //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(1440, 4, 19).toString()); //1994-12-29 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.2.5

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter 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.2.5 Dec 26, 2018 Go to the documentation of hijri 0.2.5 Download hijri 0.2.5 archive
0.2.4 Dec 26, 2018 Go to the documentation of hijri 0.2.4 Download hijri 0.2.4 archive
0.2.3 Dec 26, 2018 Go to the documentation of hijri 0.2.3 Download hijri 0.2.3 archive
0.2.2 Dec 26, 2018 Go to the documentation of hijri 0.2.2 Download hijri 0.2.2 archive
0.2.1 Dec 26, 2018 Go to the documentation of hijri 0.2.1 Download hijri 0.2.1 archive
0.2.0 Dec 26, 2018 Go to the documentation of hijri 0.2.0 Download hijri 0.2.0 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

All 19 versions...

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

We analyzed this package on Jun 19, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in libraries.

Health issues and suggestions

Document public APIs. (-1 points)

49 out of 49 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/umm_alqura_calendar.dart. (-7.24 points)

Analysis of lib/umm_alqura_calendar.dart reported 15 hints, including:

line 96 col 9: The value of the local variable 'wd' isn't used.

line 200 col 9: Use contains instead of indexOf

line 203 col 14: Use contains instead of indexOf

line 204 col 7: DO use curly braces for all flow control structures.

line 206 col 9: Use contains instead of indexOf

Maintenance suggestions

The package description is too short. (-9 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Homepage URL is insecure. (-5 points)

Update the homepage field and use a secure (https) URL.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test ^0.12.38+1