julian 0.1.0 julian: ^0.1.0 copied to clipboard
Convert between Julian day numbers, proleptic Julian calendar days and proleptic Gregorian calendar days.
// Copyright (c) 2016, Christian Stewart. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in the
// LICENSE file.
import 'package:julian/julian.dart';
main() {
// What was the Julian day number at the turn of the millennium?
// prints 2451545
print('${new Gregorian(2000, 1, 1).julianDayNumber}');
// On which Gregorian day of July should we celebrate Julius Caesar's
// birthday?
// prints 11
print('${new Julian.fromBC(100, 7, 13).toGregorian().day}');
// By how many days is the Gregorian calendar further ahead than the
// Julian calendar in 2016?
// prints 13
print('${new Julian(2016, 1, 1).julianDayNumber -
new Gregorian(2016, 1, 1).julianDayNumber}');
// On what Gregorian date is the Julian day number equal to zero?
// prints Gregorian(year: -4713, month: 11, day: 24)
print('${new Gregorian.fromJulianDayNumber(0)}');
}