Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

gdate-julian

hertzg34LGPL-2.1-only2.0.1TypeScript support: included

Converts date to and from julian days in gLib GDate style

gnome, datetime, julian, julian-day, julian-day-count, glib, glib-gdate, glib-date, gdate, g_date, leap-year, leap, year, is_leap_year, g_date_get_julian , g_date_is_leap_year, g_date_to_julian_days, g_julian_days_to_date, port, c-port, js, day, count, date, date-convert, homebank, hbf, xhb, xml, gregorian

readme

hpore# GDate (GLib) style julian days to and from gregorian date converter Port of GLib functions to work with julian days, to convert between it and gregorian date. Library was initially developed to help a sister library node-xhb work with file generated by HomeBank

Install

npm install gdate-julian

Usage

Import ESM style

import {dateToJulianDays, julianDaysToDate} from 'gdate-julian' 

Example

Here we show small example how to convert between Gregorian Date and Julian Days More detailed examples can be found in tests in ./src/__tests__/date_conversion_spec.js

Gregorian Date to Julian Days

const julianDays = dateToJulianDays(new Date('1900-01-01T12:00:00Z'))
console.log(julianDays) // outputs 693596

Julian Days to Gregorian Date

const gregorianDate = julianDaysToDate(693596)
console.log(gregorianDate) // outputs 1900-01-01T12:00:00Z

TypeScript definitions

Project also includes type definitions for TypeScript in ./src/index.d.ts

License

The code provided here is based off GLib codebase, hence licenced under same LGPL.

changelog

Changelog

All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning, enforced with semantic-release.

2.0.1 (2023-04-20)

Bug Fixes

Changelog

All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning, enforced with semantic-release.

2.0.0 (2023-04-20)

⚠ BREAKING CHANGES

  • convert to esm (#104)

Features

Changelog

All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning, enforced with semantic-release.

1.0.8 (2021-05-07)

Bug Fixes

  • deps-dev: bump lodash from 4.17.19 to 4.17.21 (#70) (1dc933c)

Changelog

All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning, enforced with semantic-release.

1.0.7 (2021-04-15)

Bug Fixes

  • deps: bump y18n from 4.0.0 to 4.0.1 (#63) (5715c32)

Changelog

All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning, enforced with semantic-release.

1.0.6 (2020-12-25)

Bug Fixes

  • deps: bump ini from 1.3.5 to 1.3.8 (#49) (9e4875e)