1.0.3 • Published 5 years ago

cky-lunar-calendar v1.0.3

Weekly downloads
2
License
MIT
Repository
gitlab
Last release
5 years ago

cky-lunar-calendar

Features!

  • Convert solar date with timezone to lunar date
  • And revert lunar date to solar date

This package use lib of Ho Ngoc Duc, convert a date to lunar date with timezone (default timezone is GMT+7)

Copyright 2004 Ho Ngoc Duc (Am lich - Ho Ngoc Duc). All Rights Reserved. Permission to use, copy, modify, and redistribute this software and its documentation for personal, non-commercial use is hereby granted provided that this copyright notice appears in all copies.

Installation

$ npm install cky-lunar-calendar --save

function

convert solar date to lunar date with timezone optional.

  • return Array [date, month, year]

    convert lunar date to solar date with timezone optional.


Test script

const lunar = require('cky-lunar-calendar');

let now = new Date();

let dateLunar = lunar.solar2Lunar(now.getDate(), now.getMonth() + 1, now.getFullYear());
console.log('Solar -> Lunar:', [now.getDate(), now.getMonth() + 1, now.getFullYear()].join('/') , '->', dateLunar[0], dateLunar[1], dateLunar[2]);


let dateSolar = lunar.lunar2Solar(now.getDate(), now.getMonth() + 1, now.getFullYear());
console.log('Lunar -> Solar:', [now.getDate(), now.getMonth() + 1, now.getFullYear()].join('/') , '->', dateSolar[0], dateSolar[1], dateSolar[2]);

Test command

$ npm test

will output like:

Solar -> Lunar: 3/6/2019 -> 1 5 2019
Lunar -> Solar: 3/6/2019 -> 5 7 2019

License

MIT

- Chickyky -

kikikikikiki

1.0.3

5 years ago

1.0.2

5 years ago