lunar-calendar-ts-vi
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

lunar-calendar-ts-vi

Lunar Calendar Typescript Library for Vietnamese

Introduction

Install

npm i lunar-calendar-ts-vi

Fix CommonJS or AMD dependencies

Add lunar-calendar-ts-vi to "architect" > "build" > "options" > "allowedCommonJsDependencies"

"architect": {
    "build": {
      ...
      "options": {
        ...
        "allowedCommonJsDependencies": [
          "lunar-calendar-ts-vi"
        ]
      },
      ...
  }
}

Usage

Basic

import { Lunar, BlockLunarDate } from 'lunar-calendar-ts-vi';
...

export class Demo {
  lunarDate!: BlockLunarDate;
    
  constructor() {
    const lunar: Lunar = new Lunar();
    // Get today
    this.lunarDate = lunar.getBlockLunarToday();
    // Or
    this.lunarDate = lunar.getBlockLunarDate(new Date());
    
    console.log(this.lunarDate);
  }
}

Convert Solar to Lunar

import { Lunar, BlockLunarDate } from 'lunar-calendar-ts-vi';
...

export class Demo {
  lunarDate!: BlockLunarDate;
    
  constructor() {
    const lunar: Lunar = new Lunar();
    this.lunarDate = lunar.getBlockLunarDate('1984-08-22');
    
    console.log(this.lunarDate);
  }
}

Get list date og month

import { Lunar, BlockLunarDate, LunarDate } from 'lunar-calendar-ts-vi';
...

export class Demo {

  constructor() {
    const lunar: Lunar = new Lunar();
    const lunarDateOfMonth: LunarDate[] = lunar.getMonth(2, 2021);
    
    console.log(lunarDateOfMonth);
  }
}

Package Sidebar

Install

npm i lunar-calendar-ts-vi

Weekly Downloads

26

Version

1.0.2

License

MIT

Unpacked Size

42.2 kB

Total Files

18

Last publish

Collaborators

  • nntuan