Lunar Calendar Typescript Library for Vietnamese
- Base on javascript library of Ho Ngoc Duc [https://www.informatik.uni-leipzig.de/~duc/]
npm i lunar-calendar-ts-vi
Add lunar-calendar-ts-vi to "architect" > "build" > "options" > "allowedCommonJsDependencies"
"architect": {
"build": {
...
"options": {
...
"allowedCommonJsDependencies": [
"lunar-calendar-ts-vi"
]
},
...
}
}
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);
}
}
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);
}
}
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);
}
}