{"_id":"@nghiavuive/lunar_date_vi","_rev":"30-6ec7ab74c8ccaa32232de67f67b1795c","time":{"created":"2023-06-19T08:07:06.262Z","1.0.0":"2023-03-24T16:27:24.677Z","modified":"2024-05-28T15:59:17.530Z","1.0.1":"2023-03-25T04:41:16.825Z","1.0.2":"2023-04-01T09:13:37.144Z","1.0.3":"2023-06-19T04:15:37.472Z","1.0.4":"2023-06-19T07:55:50.041Z","1.0.5":"2023-06-19T08:07:06.525Z","1.0.6":"2023-06-19T08:29:04.807Z","1.0.7":"2023-06-19T08:35:17.335Z","1.0.8":"2023-06-19T09:53:04.267Z","1.0.9":"2023-06-19T10:16:17.310Z","1.0.10":"2023-06-19T10:23:44.767Z","1.0.11":"2023-06-20T08:31:41.931Z","2.0.0":"2023-06-22T09:25:43.590Z","2.0.1-beta.1":"2023-08-23T07:02:53.777Z","2.0.1-beta.2":"2023-08-23T07:07:05.528Z","2.0.1-beta.3":"2023-08-23T08:11:53.692Z","2.0.1-beta.4":"2023-08-23T09:27:17.078Z","2.0.1":"2023-08-23T10:49:57.287Z"},"name":"@nghiavuive/lunar_date_vi","dist-tags":{"latest":"2.0.1","beta":"2.0.1-beta.4"},"versions":{"2.0.1-beta.4":{"name":"@nghiavuive/lunar_date_vi","version":"2.0.1-beta.4","author":{"name":"NghiaCaNgao","email":"fakenoname02@gmail.com","url":"https://nghiacangao.io.vn"},"license":"ISC","description":"A tool for converting lunar date and solar date and vice versa","repository":{"type":"git","url":"git+https://github.com/NghiaCaNgao/LunarDate.git"},"bugs":{"url":"https://github.com/NghiaCaNgao/LunarDate/issues"},"homepage":"https://github.com/NghiaCaNgao/LunarDate","keywords":["calendar, lunar, solar, lunar_date, solar_date, month, lunar_month, SolarDate, LunarDate"],"main":"dist/index.umd.js","module":"dist/index.umd.js","browser":"dist/index.umd.js","types":"dist/index.d.ts","typings":"dist/index.d.ts","scripts":{"build":"rimraf dist dev/dist && rollup -c rollup.config.mjs","test":"jest --coverage"},"devDependencies":{"@jest/globals":"^29.5.0","@rollup/plugin-terser":"^0.4.3","@rollup/plugin-typescript":"^11.0.0","rollup-plugin-dts":"^5.3.0","rollup-plugin-esbuild":"^5.0.0","@types/node":"^18.15.3","jest":"^29.5.0","rimraf":"^5.0.1","ts-jest":"^29.1.0","ts-loader":"^9.4.3","ts-node":"^10.9.1","tslib":"^2.5.3","typescript":"^5.1.3"},"readme":"<h1 align=\"center\">Lunar Date</h1> <br>\r\n<p align=\"center\">Thư viện Javascript chuyển đổi âm lịch - dương lịch</p>\r\n<p align=\"center\">\r\nRemake từ <b><a href=\"https://www.informatik.uni-leipzig.de/~duc/amlich/calrules.html\">Thuật toán Âm Lịch</a></b> của Hồ Ngọc Đức viết năm 2004\r\n</p>\r\n<div align=\"center\">\r\n\r\n![npm](https://img.shields.io/npm/v/%40nghiavuive%2Flunar_date_vi)\r\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/%40nghiavuive%2Flunar_date_vi)\r\n![npm downloads](https://img.shields.io/npm/dy/@nghiavuive/lunar_date_vi)\r\n\r\n</div>\r\n\r\n## Table of Contents\r\n\r\n- [Features](#features)\r\n- [Installation](#installation)\r\n  - [Package manager](#package-manager)\r\n  - [CDN](#cdn)\r\n- [Examples](#examples)\r\n- [API](#api)\r\n  - [Interfaces](#interfaces)\r\n    - [ICalendarDate](#icalendardate)\r\n    - [ISolarDate](#isolardate)\r\n    - [ILunarDate](#ilunardate)\r\n    - [ILuckyHour](#iluckyhour)\r\n  - [SolarDate](#solardate)\r\n    - [Solar constructor 1](#solar-constructor-1)\r\n    - [Solar constructor 2](#solar-constructor-2)\r\n    - [SolarDate.FIRST_DAY](#solardatefirst_day)\r\n    - [SolarDate.LAST_DAY](#solardatelast_day)\r\n    - [SolarDate.fromJd()](#solardatefromjd)\r\n    - [SolarDate.jdn()](#solardatejdn)\r\n    - [solar.toDate()](#solartodate)\r\n    - [solar.toLunarDate()](#solartolunardate)\r\n    - [solar.setDate()](#solarsetdate)\r\n    - [solar.get()](#solarget)\r\n  - [LunarDate](#lunardate)\r\n    - [Lunar constructor](#lunar-constructor)\r\n    - [SolarDate.fromSolarDate()](#solardatefromsolardate)\r\n    - [lunar.init()](#lunarinit)\r\n    - [lunar.get()](#lunarget)\r\n    - [lunar.getYearName()](#lunargetyearname)\r\n    - [lunar.getMonthName()](#lunargetmonthname)\r\n    - [lunar.getDayName()](#lunargetdayname)\r\n    - [lunar.getHourName()](#lunargethourname)\r\n    - [lunar.getDayOfWeek()](#lunargetdayofweek)\r\n    - [lunar.getSolarTerm()](#lunargetsolarterm)\r\n    - [lunar.getLuckyHours()](#lunargetluckyhours)\r\n    - [lunar.toSolarDate()](#lunartosolardate)\r\n    - [lunar.setDate()](#lunarsetdate)\r\n    - [lunar.setDate()](#lunarsetdate)\r\n\r\n## Features\r\n\r\n- Chuyển đổi lịch dương sang lịch âm (của Việt Nam) và ngược lại.\r\n- Tính các thông tin của lịch âm như: giờ Hoàng Đạo, tên của giờ, tháng, năm theo can chi\r\n\r\n## Installation\r\n\r\n### Package manager\r\n\r\nCài đặt qua NPM\r\n\r\n```bash\r\nnpm install @nghiavuive/lunar_date_vi\r\n```\r\n\r\nKhi cài đặt xong, ta có thể import bằng `import` hoặc `require`. Trước khi bắt đầu, đảm bảo rằng `package.json` có `\"type\": \"module\"`.\r\n\r\n```typescript\r\nimport { LunarDate, SolarDate } from \"@nghiavuive/lunar_date_vi\";\r\n```\r\n\r\nNếu sử dụng Typescript, lưu ý cấu hình `tsconfig.json` như sau:\r\n\r\n```json\r\n{\r\n  \"compilerOptions\": {\r\n    \"esModuleInterop\": true,\r\n    \"moduleResolution\": \"node\",\r\n    \"module\": \"ESNext\"\r\n  },\r\n  \"include\": [\"./**/*.ts\"],\r\n  \"exclude\": [\"node_modules\"]\r\n}\r\n```\r\n\r\nNếu sử dụng `require`\r\n\r\n```javascript\r\nconst calendar = require(\"@nghiavuive/lunar_date_vi/dist/index.cjs\");\r\n```\r\n\r\n### CDN\r\n\r\nSử dụng qua jsDelivr\r\n\r\n```bash\r\n<script src=\"https://cdn.jsdelivr.net/gh/NghiaCaNgao/lunarDate@latest/dist/index.umd.js\"></script>\r\n```\r\n\r\n## Examples\r\n\r\nSử dụng `ES Module` với Typescript. JavaScript tương tự.\r\n\r\n> **Note** Nếu sử dụng `ts-node` thì cần chạy `npx ts-node --esm <filename>`. Hiện tại chưa tương thích với Node 20.x\r\n\r\nĐoạn lệnh sau chuyển từ lịch dương sang lịch âm (trên) và âm sang dương (dưới).\r\n\r\n> **Note** Khi khởi tạo instance LunarDate thì luôn phải gọi hàm `init()`\r\n\r\n```typescript\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconst solar_date = new SolarDate(new Date());\r\nconsole.log(solar_date);\r\nconsole.log(solar_date.toLunarDate());\r\n\r\nconst lunar_date = new LunarDate({ day: 10, month: 5, year: 2023 });\r\nlunar_date.init(); // initialize lunar_date before using\r\nconsole.log(lunar_date.toSolarDate());\r\n\r\n// SolarDate {\r\n//   day: 19,\r\n//   month: 6,\r\n//   year: 2023,\r\n//   name: 'solar_calendar',\r\n//   jd: 2460115,\r\n//   leap_year: false\r\n// }\r\n\r\n// LunarDate {\r\n//   day: 2,\r\n//   month: 5,\r\n//   year: 2023,\r\n//   name: 'lunar_calendar',\r\n//   jd: 2460115,\r\n//   leap_year: true,\r\n//   leap_month: false\r\n// }\r\n\r\n// SolarDate {\r\n//   day: 27,\r\n//   month: 6,\r\n//   year: 2023,\r\n//   name: 'solar_calendar',\r\n//   jd: 2460123,\r\n//   leap_year: false\r\n// }\r\n```\r\n\r\nNếu sử dụng `CommonJs`\r\n\r\n```javascript\r\nconst _calendar = require(\"@nghiavuive/lunar_date_vi/dist/index.cjs\");\r\n\r\nvar solar_date = new _calendar.SolarDate(new Date());\r\nvar lunar_date = solar_date.toLunarDate();\r\n\r\nconsole.log(lunar_date.getMonthName()); // Mậu Ngọ\r\n```\r\n\r\nNếu sử dụng `UMD`\r\n\r\n```html\r\n<script src=\"https://cdn.jsdelivr.net/gh/NghiaCaNgao/lunarDate@1a7fb3b/dist/index.umd.js\"></script>\r\n<script>\r\n  var lunar_date = new window._calendar.LunarDate({\r\n    day: 1,\r\n    month: 1,\r\n    year: 2020,\r\n  });\r\n  lunar_date.init();\r\n  console.log(lunar_date);\r\n</script>\r\n\r\n<!-- SolarDate {\r\n  day: 1,\r\n  month: 1,\r\n  year: 2020,\r\n  name: 'lunar_calendar',\r\n  jd: 2458874,\r\n  leap_year: false,\r\n  leap_month: false,\r\n} -->\r\n```\r\n\r\n## API\r\n\r\n### Interfaces\r\n\r\n#### `ICalendarDate`\r\n\r\nInput của **`Calendar`** (abstract class [**`LunarDate`**](#lunardate) và [**`SolarDate`**](#solardate))\r\n\r\n```ts\r\nexport interface ICalendar {\r\n  day: number;\r\n  month: number;\r\n  year: number;\r\n}\r\n```\r\n\r\n#### `ISolarDate`\r\n\r\nInput của [**`SolarDate`**](#solardate). Kế thừa từ [**`ICalendarDate`**](#icalendardate)\r\n\r\n```ts\r\ninterface ISolarDate extends ICalendar {}\r\n```\r\n\r\n#### `ILunarDate`\r\n\r\nInput của [**`LunarDate`**](#lunardate). Kế thừa từ [**`ICalendarDate`**](#icalendardate)\r\n\r\n```ts\r\ninterface ILunarDate extends ICalendarDate {\r\n  jd?: number;\r\n  leap_month?: boolean;\r\n  leap_year?: boolean;\r\n}\r\n```\r\n\r\n#### `ILuckyHour`\r\n\r\nCung hoàng đạo\r\n\r\n```ts\r\ninterface ILuckyHour {\r\n  name: string;\r\n  time: number[];\r\n}\r\n```\r\n\r\n### SolarDate\r\n\r\n#### Solar constructor 1\r\n\r\nTạo thực thể [**`SolarDate`**](#solardate) từ [**`ISolarDate`**](#isolardate).\r\n\r\n> **Note** Nếu nhập sai ngày tháng thì sẽ báo lỗi `Invalid date`. Chi tiết về ngày hợp lệ xem [tại đây](https://github.com/NghiaCaNgao/lunarDate/wiki/Valid-dae)\r\n\r\n```ts\r\npublic constructor(date: ISolarDate);\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nnew SolarDate({ day: 1, month: 1, year: 2023 });\r\n```\r\n\r\n#### Solar constructor 2\r\n\r\nTạo thực thể [**`SolarDate`**](#solardate) từ `Date` object.\r\n\r\n> **Note** Nếu nhập sai ngày tháng thì đối tượng `Date` sẽ tự sửa lại. Nếu ngày nhập vào nằm trong khoảng từ **05-14/10/1582** thì sẽ báo lỗi `Invalid date`. Chi tiết về ngày hợp lệ xem [tại đây](https://github.com/NghiaCaNgao/lunarDate/wiki/Valid-dae)\r\n\r\n```ts\r\npublic constructor(date: Date);\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nnew SolarDate(new Date());\r\n```\r\n\r\n#### `SolarDate.FIRST_DAY`\r\n\r\nNgày Julian tương ứng ngày đầu tiên trong giới hạn tính toán `1200-1-31`\r\n\r\n```ts\r\npublic static readonly FIRST_DAY: number = SolarDate.jdn(new Date(1200, 0, 31)); //1200-1-31\r\n```\r\n\r\n#### `SolarDate.LAST_DAY`\r\n\r\nNgày Julian tương ứng ngày cuối cùng trong giới hạn tính toán `2199-12-31`\r\n\r\n```ts\r\npublic static readonly LAST_DAY: number = SolarDate.jdn(new Date(2199, 11, 31)); //2199-12-31\r\n```\r\n\r\n#### `SolarDate.fromJd()`\r\n\r\nTrả về một thực thể [**`SolarDate`**](#solardate) từ ngày Julian.\r\n\r\n```ts\r\nstatic fromJd(jd: number): SolarDate\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconsole.log(SolarDate.fromJd(2460035));\r\n\r\n// SolarDate { day: 31, month: 3, year: 2023, jd: 2460035, leap: false }\r\n```\r\n\r\n#### `SolarDate.jdn()`\r\n\r\nTrả về ngày Julian date tương ứng với [**`ICalendarDate`**](#icalendardate) hoặc `Date`\r\nRef: https://ssd.jpl.nasa.gov/tools/jdc/#/jd\r\n\r\n```ts\r\nstatic jdn(date: ICalendarDate | Date): number\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconsole.log(SolarDate.jdn(new Date())); // 2460115\r\nconsole.log(SolarDate.jdn({ day: 19, month: 6, year: 2023 })); // 2460115\r\n```\r\n\r\n#### `solar.toDate()`\r\n\r\nChuyển thực thể [**`SolarDate`**](#solardate) về dạng **`Date`**\r\n\r\n```ts\r\ntoDate(): Date\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconst solar = new SolarDate(new Date());\r\nconsole.log(solar.toDate());\r\n\r\n// 2023-06-18T17:00:00.000Z\r\n```\r\n\r\n#### `solar.toLunarDate()`\r\n\r\nChuyển từ thực thể [**`SolarDate`**](#solardate) sang thực thể [**`LunarDate`**](#lunardate)\r\n\r\n```ts\r\ntoLunarDate(): LunarDate\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nvar solar = new SolarDate(new Date());\r\nvar lunar = solar.toLunarDate();\r\n\r\nconsole.log(lunar);\r\n\r\n// LunarDate {\r\n//   day: 2,\r\n//   month: 5,\r\n//   year: 2023,\r\n//   name: 'lunar_calendar',\r\n//   jd: 2460115,\r\n//   leap_year: true,\r\n//   leap_month: false\r\n// }\r\n```\r\n\r\n#### `solar.setDate()`\r\n\r\nThay đổi thời gian của thực thể [**`SolarDate`**](#solardate)\r\n\r\n```ts\r\nsetDate(date: ICalendarDate | Date): void\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nvar solar = new SolarDate(new Date()); // 2023-06-19\r\n\r\nsolar.setDate(new Date(2023, 1, 1));\r\nconsole.log(solar);\r\n\r\n// SolarDate {\r\n//     day: 1,\r\n//     month: 2,\r\n//     year: 2023,\r\n//     name: 'solar_calendar',\r\n//     jd: 2459977,\r\n//     leap_year: false\r\n// }\r\n\r\nsolar.setDate({ day: 5, month: 5, year: 2015 });\r\nconsole.log(solar);\r\n\r\n// SolarDate {\r\n//     day: 5,\r\n//     month: 5,\r\n//     year: 2015,\r\n//     name: 'solar_calendar',\r\n//     jd: 2457148,\r\n//     leap_year: false\r\n// }\r\n```\r\n\r\n#### `solar.get()`\r\n\r\nLấy thông tin của thực thể [**`SolarDate`**](#solardate)\r\n\r\n```ts\r\nget();\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconst dl = new SolarDate(new Date());\r\nconsole.log(dl.get());\r\n\r\n// {\r\n//   name: 'solar_calendar',\r\n//   day: 19,\r\n//   month: 6,\r\n//   year: 2023,\r\n//   leap_year: false,\r\n//   julian: 2460115\r\n// }\r\n```\r\n\r\n### LunarDate\r\n\r\n#### Lunar constructor\r\n\r\nTạo thực thể [**`LunarDate`**](#lunardate) từ [**`ILunarDate`**](#ilunardate)\r\n\r\n> **Note** Để nhập tháng nhuận, sử dụng thêm attr `leap_month = true`. Nếu sử dụng `leap_month = true` với tháng không thể nhuận, tư động chuyển về `leap_month = false`.\r\n\r\n> **Note** Nếu nhập sai ngày tháng sẽ trả về lỗi [**`Invalid date`**](https://github.com/NghiaCaNgao/LunarDate/wiki/Error-message)\r\n\r\n> **Note** Khi khởi tạo cần điền đầy đủ `day`, `month`, `year`. Nếu không điền các thông tin khác (`leap_year`, ...) thì mặc định là `undefined`. Sau khi khởi tạo có thể sử dụng hàm [**`lunar.init()`**](#lunarinit) để tự động điền các thông tin còn thiếu. Nếu các thông tin (`leap_year`, `jd`,...) là `undefined` thì sẽ không thể sử dụng được các hàm khác trong thực thể.\r\n\r\n```ts\r\nconstructor(date: ILunarDate)\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconst al = new LunarDate({ day: 1, month: 1, year: 2023 });\r\nconsole.log(al);\r\n\r\n// LunarDate {\r\n//   day: 1,\r\n//   month: 1,\r\n//   year: 2023,\r\n//   name: 'lunar_calendar',\r\n//   jd: undefined,\r\n//   leap_year: undefined,\r\n//   leap_month: undefined\r\n// }\r\n\r\nconst al = new LunarDate({ day: 1, month: 2, year: 2023, leap_month: true });\r\nal.init();\r\nconsole.log(al.toSolarDate());\r\n\r\n// SolarDate {\r\n//   day: 22,\r\n//   month: 3,\r\n//   year: 2023,\r\n//   name: 'solar_calendar',\r\n//   jd: 2460026,\r\n//   leap_year: false\r\n// }\r\n```\r\n\r\n#### `SolarDate.fromSolarDate()`\r\n\r\nChuyển từ [**`SolarDate`**](#solardate) sang [**`LunarDate`**](#lunardate).\r\n\r\n```ts\r\nstatic fromSolarDate(date: SolarDate): LunarDate\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconst dl = new SolarDate(new Date());\r\nconsole.log(LunarDate.fromSolarDate(dl));\r\n\r\n// LunarDate {\r\n//   day: 2,\r\n//   month: 5,\r\n//   year: 2023,\r\n//   name: 'lunar_calendar',\r\n//   jd: 2460115,\r\n//   leap_year: true,\r\n//   leap_month: false\r\n// }\r\n```\r\n\r\n#### `lunar.init()`\r\n\r\nKhởi tạo giá trị cho thực thể. Nếu `force_change = false`, chỉ áp dụng thay đổi giá trị phụ (`leap-year`, `jd`, ...) của thực thể khi chúng khác `undefined`. Nếu `force_change = true`, luôn thay đổi giá trị phụ.\r\n\r\n```ts\r\ninit(force_change: boolean = false)\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nlet lunar = new LunarDate({ day: 2, month: 5, year: 2023 });\r\nlunar.init();\r\nconsole.log(lunar);\r\n\r\n// LunarDate {\r\n//   day: 2,\r\n//   month: 5,\r\n//   year: 2023,\r\n//   name: 'lunar_calendar',\r\n//   jd: 2460115,\r\n//   leap_year: true,\r\n//   leap_month: false\r\n// }\r\n```\r\n\r\n#### `lunar.get()`\r\n\r\nLấy thông tin của thực thể [**`LunarDate`**](#lunardate).\r\n\r\n```ts\r\nget();\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nconst dl = new SolarDate(new Date());\r\nconst al = LunarDate.fromSolarDate(dl);\r\nconsole.log(al.get());\r\n\r\n// {\r\n//   name: 'lunar_calendar',\r\n//   day: 2,\r\n//   month: 5,\r\n//   year: 2023,\r\n//   leap_year: true,\r\n//   julian: 2460115,\r\n//   year_name: 'Quý Mão',\r\n//   leap_month: false\r\n// }\r\n```\r\n\r\n#### `lunar.getYearName()`\r\n\r\nLấy tên của năm theo can chi.\r\n\r\n```ts\r\ngetYearName(): string\r\n```\r\n\r\n#### `lunar.getMonthName()`\r\n\r\nLấy tên của tháng theo can chi.\r\n\r\n```ts\r\ngetMonthName(): string\r\n```\r\n\r\n#### `lunar.getDayName()`\r\n\r\nLấy tên của ngày theo can chi.\r\n\r\n```ts\r\ngetDayName(): string\r\n```\r\n\r\n#### `lunar.getHourName()`\r\n\r\nLấy tên của giờ theo can chi.\r\n\r\n```ts\r\ngetHourName(): string\r\n```\r\n\r\n#### `lunar.getDayOfWeek()`\r\n\r\nLấy tên thứ trong tuần.\r\n\r\n```ts\r\ngetDayOfWeek(): string\r\n```\r\n\r\n#### `lunar.getSolarTerm()`\r\n\r\nLấy tên tiết khí\r\n\r\n```ts\r\ngetTietKhi(): string\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nlet lunar = new LunarDate({ day: 2, month: 5, year: 2023 });\r\nlunar.init();\r\n\r\nconsole.log(lunar.getYearName()); // Quý Mão\r\nconsole.log(lunar.getMonthName()); // Mậu Ngọ\r\nconsole.log(lunar.getDayName()); // Mậu Thân\r\nconsole.log(lunar.getHourName()); // Nhâm Tý\r\nconsole.log(lunar.getSolarTerm()); // Mang chủng\r\nconsole.log(lunar.getDayOfWeek()); // Thứ hai\r\n```\r\n\r\n#### `lunar.getLuckyHours()`\r\n\r\nLấy giờ hoàng đạo.\r\n\r\n```ts\r\ngetLuckyHours(): Array<ILuckyHour>\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconst dl = new SolarDate(new Date());\r\nconst al = LunarDate.fromSolarDate(dl);\r\nconsole.log(al.getZodiacHour());\r\n\r\n// [\r\n//   { name: 'Tý', time: [ 23, 1 ] },\r\n//   { name: 'Sửu', time: [ 1, 3 ] },\r\n//   { name: 'Thìn', time: [ 7, 9 ] },\r\n//   { name: 'Tỵ', time: [ 9, 11 ] },\r\n//   { name: 'Mùi', time: [ 13, 15 ] },\r\n//   { name: 'Tuất', time: [ 19, 21 ] }\r\n// ]\r\n```\r\n\r\n#### `lunar.toSolarDate()`\r\n\r\nChuyển từ [**`LunarDate`**](#lunardate) sang [**`SolarDate`**](#solardate).\r\n\r\n```ts\r\ntoSolarDate(): SolarDate\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconst al = new LunarDate({ day: 2, month: 5, year: 2023 });\r\nal.init();\r\n\r\nconsole.log(al.toSolarDate());\r\n\r\n// SolarDate {\r\n//   day: 19,\r\n//   month: 6,\r\n//   year: 2023,\r\n//   name: 'solar_calendar',\r\n//   jd: 2460115,\r\n//   leap_year: false\r\n// }\r\n```\r\n\r\n#### `lunar.setDate()`\r\n\r\nThay đổi thời gian của thực thể [**`LunarDate`**](#lunardate)\r\n\r\n> **Note** Hàm này chưa chuẩn hóa dữ liệu vào\r\n\r\n```ts\r\nsetDate(date: ILunarDate): void\r\n```\r\n\r\n**Ví dụ:**\r\n\r\n```ts\r\nimport { SolarDate, LunarDate } from \"@nghiavuive/lunar_date_vi\";\r\n\r\nconst al = new LunarDate({ day: 2, month: 5, year: 2023 });\r\nal.init();\r\nal.setDate({ day: 2, month: 10, year: 2023 });\r\n\r\nconsole.log(al.toSolarDate());\r\n\r\n// SolarDate {\r\n//   day: 14,\r\n//   month: 11,\r\n//   year: 2023,\r\n//   name: 'solar_calendar',\r\n//   jd: 2460263,\r\n//   leap_year: false\r\n// }\r\n```\r\n","readmeFilename":"README.md","gitHead":"b1a28b5b43e7411b3291f9acf94ca1185a1921ea","_id":"@nghiavuive/lunar_date_vi@2.0.1-beta.4","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-3hcdZLcsdCNZtl1S7GXIuNmvGTYMgtDTxgrk9Y4pG7f9q2ORU4w2nMvNOVs1muOzbtLJKMsPC1sxzJ3i05YhzA==","shasum":"3e8ef938c38561792c8ea063bfce7bc7fc15a3fe","tarball":"https://registry.npmjs.org/@nghiavuive/lunar_date_vi/-/lunar_date_vi-2.0.1-beta.4.tgz","fileCount":11,"unpackedSize":113076,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCF5Yo+ZYP5UZ0x/bPn/+vJZjOV8Udz1BzZXBXB9MpLXgIgbLNFL+PC0bIUA5Z47T9OAJzK+pMsBspEaDWKPGW07Zg="}]},"_npmUser":{"name":"nghiacangao","email":"fakenoname02@gmail.com"},"directories":{},"maintainers":[{"name":"nghiacangao","email":"fakenoname02@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lunar_date_vi_2.0.1-beta.4_1692782836903_0.526912391123463"},"_hasShrinkwrap":false},"2.0.1":{"name":"@nghiavuive/lunar_date_vi","version":"2.0.1","author":{"name":"NghiaCaNgao","email":"fakenoname02@gmail.com","url":"https://nghiacangao.io.vn"},"license":"ISC","description":"A tool for converting lunar date and solar date and vice versa","repository":{"type":"git","url":"git+https://github.com/NghiaCaNgao/LunarDate.git"},"bugs":{"url":"https://github.com/NghiaCaNgao/LunarDate/issues"},"homepage":"https://github.com/NghiaCaNgao/LunarDate","keywords":["calendar, lunar, solar, lunar_date, solar_date, month, lunar_month, SolarDate, LunarDate"],"main":"dist/index.umd.js","module":"dist/index.umd.js","browser":"dist/index.umd.js","types":"dist/index.d.ts","typings":"dist/index.d.ts","scripts":{"build":"rimraf dist dev/dist && rollup -c rollup.config.mjs","test":"jest --coverage"},"devDependencies":{"@jest/globals":"^29.5.0","@rollup/plugin-terser":"^0.4.3","@rollup/plugin-typescript":"^11.0.0","rollup-plugin-dts":"^5.3.0","rollup-plugin-esbuild":"^5.0.0","@types/node":"^18.15.3","jest":"^29.5.0","rimraf":"^5.0.1","ts-jest":"^29.1.0","ts-loader":"^9.4.3","ts-node":"^10.9.1","tslib":"^2.5.3","typescript":"^5.1.3"},"gitHead":"0fe986c92e86185e3e6f2a258910d46dac731a57","_id":"@nghiavuive/lunar_date_vi@2.0.1","_nodeVersion":"18.17.1","_npmVersion":"9.6.7","dist":{"integrity":"sha512-BCczHEHCvzYBZvexGvC9bd1lV8X1E7gRg+/dl8UXSHX3Fl66WmmLs5J8OoO3A70NrUOeYTMU1JNvDwOOepsotQ==","shasum":"725587f56975ca4163baf80d30d50658dba2f6ad","tarball":"https://registry.npmjs.org/@nghiavuive/lunar_date_vi/-/lunar_date_vi-2.0.1.tgz","fileCount":11,"unpackedSize":113065,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICjt7NOmXn1VTplWBO/8tYsJcrVZ1PqKU3sWcC1zj3o6AiEAu06XiK6+Qciu8JR6/EqPpH0o/DrdlMQLCIQQZWlAhCk="}]},"_npmUser":{"name":"nghiacangao","email":"fakenoname02@gmail.com"},"directories":{},"maintainers":[{"name":"nghiacangao","email":"fakenoname02@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/lunar_date_vi_2.0.1_1692787797085_0.9379151879346632"},"_hasShrinkwrap":false}},"maintainers":[{"name":"nghiacangao","email":"fakenoname02@gmail.com"}],"description":"A tool for converting lunar date and solar date and vice versa","homepage":"https://github.com/NghiaCaNgao/LunarDate","keywords":["calendar, lunar, solar, lunar_date, solar_date, month, lunar_month, SolarDate, LunarDate"],"repository":{"type":"git","url":"git+https://github.com/NghiaCaNgao/LunarDate.git"},"author":{"name":"NghiaCaNgao","email":"fakenoname02@gmail.com","url":"https://nghiacangao.io.vn"},"bugs":{"url":"https://github.com/NghiaCaNgao/LunarDate/issues"},"license":"ISC","readme":"","readmeFilename":""}