libcalendar 0.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

Calendar Conversion Library for Dart #

Pub Build Status

This library defines the following methods for calendar conversion:

  • fromGregorianToCJDN()
    • Gregorian calendar to Chronological Julian Day Number (CJDN) conversion.
  • fromCJDNtoGregorian()
    • Chronological Julian Day Number (CJDN) to Gregorian calendar conversion.
  • fromIslamicToCJDN()
    • Islamic calendar to Chronological Julian Day Number (CJDN) conversion.
  • fromCJDNtoIslamic()
    • Chronological Julian Day Number (CJDN) to Islamic calendar conversion.
  • fromGregorianToIslamic()
    • Gregorian calendar to Islamic calendar conversion.
  • fromIslamicToGregorian()
    • Islamic calendar to Gregorian calendar conversion.
  • fromGregorianToJulianDate()
    • Gregorian calendar to Julian Date conversion.
  • fromJulianDateToGregorian()
    • Julian Date to Gregorian calendar conversion.

How to use #

  1. Open your pubspec.yaml file and add this entry:

     libcalendar: ^0.2.0
    
  2. Then run pub get.

  3. Import this library into your code:

     import 'package:libpray/libcalendar.dart';
    

A simple usage example:

import 'package:libcalendar/libcalendar.dart';

void main() {
  // September 7th, 2010 in Gregorian.
  final int year = 2010;
  final int month = 9;
  final int day = 7;

  // Convert to CJDN.
  final int cjdn = fromGregorianToCJDN(year, month, day);
  print('September 7th, 2010 in CJDN: $cjdn');

  // Convert to Islamic.
  final DateTime islamic = fromGregorianToIslamic(year, month, day);
  print('September 7th, 2010 in Islamic: ${islamic.day}/${islamic.month}/${islamic.year}');
}

The output should be as follows:

September 7th, 2010 in CJDN: 2455447
September 7th, 2010 in Islamic: 28/9/1431

Features and Bugs #

Please file feature requests and bugs at the issue tracker.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

Change Log #

0.0.1 #

  • Initial version.
  • [NEW]: Gregorian-CJDN conversion.
  • [NEW]: Islamic-CJDN conversion.
  • [NEW]: Gregorian-Islamic conversion.

0.0.2 #

  • [NEW]: Gregorian-Julian Date conversion.

0.1.0 #

  • [BREAKING CHANGES]: libcalendar now requires Dart 2 SDK.

0.2.0 #

  • [BREAKING CHANGES]: Updated Dart SDK requirement.
  • [BREAKING CHANGES]: Upgraded all dependencies to latest version (as on October 4th, 2018).

example/libcalendar_example.dart

import 'package:libcalendar/libcalendar.dart';

void main() {
  // September 7th, 2010 in Gregorian.
  const int year = 2010;
  const int month = 9;
  const int day = 7;

  // Convert to CJDN.
  final int cjdn = fromGregorianToCJDN(year, month, day);
  print('September 7th, 2010 in CJDN: $cjdn');

  // Convert to Islamic.
  final DateTime islamic = fromGregorianToIslamic(year, month, day);
  print('September 7th, 2010 in Islamic: ${islamic.day}/${islamic.month}/${islamic.year}');
}

Use this package as a library

1. Depend on it

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


dependencies:
  libcalendar: ^0.2.0

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:libcalendar/libcalendar.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
64
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
71
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:libcalendar/libcalendar.dart.

Health suggestions

Format lib/src/calendar_converter.dart.

Run dartfmt to format lib/src/calendar_converter.dart.

Maintenance suggestions

The package description is too short. (-20 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.

Package is getting outdated. (-9.32 points)

The package was last published 57 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
logging ^0.11.3+2 0.11.3+2
meta ^1.1.6 1.1.8
Dev dependencies
test ^1.3.4