gdate-julian
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

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.

Dependencies (0)

    Dev Dependencies (11)

    Package Sidebar

    Install

    npm i gdate-julian

    Weekly Downloads

    7

    Version

    2.0.1

    License

    LGPL-2.1-only

    Unpacked Size

    32.9 kB

    Total Files

    9

    Last publish

    Collaborators

    • hertzg