๊ณ ์ ๋ฐ ์๋ ฅ ๋ผ์ด๋ธ๋ฌ๋ฆฌ โ ๊ฐ์ง ยท ๋ ยท ์ ๊ธฐ ยท ๋ช ์ ยท ํฌ๋งท ยท ๋ค๊ตญ์ด
์ฒ๋ฌธ ์๊ณ ๋ฆฌ์ฆ ๊ธฐ๋ฐ ์๋ ฅ ๊ณ์ฐ. ์ค๊ตญยท์ผ๋ณธยทํ๊ตญยท๋ฒ ํธ๋จ 4์ข ์๋ ฅ ๋ณํ ๋ฐ ๊ฐ์ฒด์ค๊ตญ์ดยท๋ฒ์ฒด์ค๊ตญ์ด(๋๋ง/ํ์ฝฉ)ยทๆฅๆฌ่ชยทํ๊ตญ์ดยทTiแบฟng Viแปt 6๊ฐ ์ธ์ด ์ง์.
Copyright (c) 2025 ๅไบฌ้้็งๆๆ้ๅ ฌๅธ (้ญ็ๅณฐ, ๅด็ผ). MIT License.
import { ChineseDate } from 'chinese-lunar-date'
const date = ChineseDate.fromGregorian(2024, 6, 21)
date.yearGanZhi // "็ฒ่พฐ"
date.zodiac // "์ฉ"
date.zodiacEmoji // "๐"
date.formatFull() // "๊ฐ์ง์ฉ๋
5์์ด์ก"
CalendarConfig๋ก ์ค์ ๊ตฌ๋. ์๋ก ๋ค๋ฅธ ๊ธฐ์๊ณผ ์๊ฐ๋ ์ด๋ ฅ์ ๋์ผ ์๊ณ ๋ฆฌ์ฆ ์ ์ฉChineseDate ๋ฑ)๋ ๋ถ๋ณ ๊ฐ ๊ฐ์ฒด, ์ ์์ค ์๊ณ ๋ฆฌ์ฆ์ ๋ชจ๋ ์์ ํจ์. ๋ ๋ชจ๋๋ฅผ ๋
๋ฆฝ์ ์ผ๋ก ์ฌ์ฉ ๊ฐ๋ฅ| chinese-lunar-date | date-chinese | lunar-javascript | |
|---|---|---|---|
| ์ ๋ฐ๋ | ์ฒ๋ฌธ ์๊ณ ๋ฆฌ์ฆ(VSOP87) | ์ฒ๋ฌธ ์๊ณ ๋ฆฌ์ฆ | ํ ์กฐํ๋ฒ |
| TypeScript | ๋ค์ดํฐ๋ธ TS, ์์ ํ์ | JSDoc ์ด๋ ธํ ์ด์ | ์ปค๋ฎค๋ํฐ @types |
| API ์คํ์ผ | ๋ถ๋ณ ๊ฐ ๊ฐ์ฒด | ํจ์ํ + ๋ด๋ถ ํด๋์ค | ๊ฐ๋ณ ๊ฐ์ฒด |
| ๊ฐ์ง | ์ฐ์์ผ ์ผ์ฃผ | ์ฐ์ฃผ๋ง | ์ฐ์์ผ ์ผ์ฃผ |
| ๋ | 6๊ฐ ์ธ์ด + Emoji | ์์ | ์ค๊ตญ์ด๋ง |
| ์ ๊ธฐ | 24์ ๊ธฐ, 6๊ฐ ์ธ์ด | ์์ | ์ค๊ตญ์ด๋ง |
| ๋ช ์ | 13์ข , ์ง์ญ๋ณ ํํฐ | ์์ | ์ค๊ตญ์ด๋ง |
| ๋ค์ญ๋ฒ | ์ค / ์ผ / ํ / ๋ฒ | ์ค๊ตญ๋ง | ์ค๊ตญ๋ง |
| ๋ฒ์ฒด์ค๊ตญ์ด | zh-TW / zh-HK ๊ฐ๋ณ ๋์ | ์์ | ์์ |
| ํฌ๋งท | 5์ข ๋ด์ฅ + ์ปค์คํ ํจํด | ์์ | ์ ํ์ |
| ํฌ๊ธฐ (gzip) | ~16 KB | ~15 KB | ~20 KB |
with() / addDays()๋ ์ ์ธ์คํด์ค ๋ฐํzh-CN / zh-TW / zh-HK / ja-JP / ko-KR / vi-VNnpm install chinese-lunar-date
import { ChineseDate } from 'chinese-lunar-date'
const date = ChineseDate.fromGregorian(2024, 6, 21)
const date2 = ChineseDate.fromDate(new Date(2024, 5, 21))
const today = ChineseDate.today()
const date3 = ChineseDate.fromValue({ cycle: 78, year: 34, month: 5, leap: false, day: 6 })
const date = ChineseDate.fromGregorian(2024, 6, 21)
date.cycle // 78
date.year // 34
date.month // 5
date.leap // false
date.day // 6
date.gregorianYear // 2024
date.yearGanZhi // "็ฒ่พฐ"
date.monthGanZhi // "ๅบๅ"
date.dayGanZhi // "็ฒๅฏ
"
date.zodiac // "์ฉ"
date.zodiacEmoji // "๐"
date.zodiacIndex // 4
const date = ChineseDate.fromGregorian(2024, 6, 21)
date.formatFull('ko-KR') // "๊ฐ์ง์ฉ๋
5์์ด์ก"
date.formatGanZhi() // "็ฒ่พฐๅนด ๅบๅๆ ็ฒๅฏ
ๆฅ"
date.formatCompact() // "78/34/5/0/6"
date.format('{Ygz}{Z}๋
{Mname}{Dname}', 'ko-KR') // "๊ฐ์ง์ฉ๋
5์์ด์ก"
const date = ChineseDate.fromGregorian(2024, 6, 21)
const tomorrow = date.addDays(1)
const yesterday = date.addDays(-1)
const firstDay = date.with({ day: 1 })
tomorrow.isAfter(date) // true
const date = ChineseDate.fromGregorian(2024, 6, 21)
date.toGregorian() // { year: 2024, month: 6, day: 21 }
date.toDate() // Date object
date.toJSON() // { cycle: 78, year: 34, month: 5, leap: false, day: 6 }
import { ChineseDate, JapaneseDate, KoreanDate, VietnameseDate } from 'chinese-lunar-date'
const cn = ChineseDate.fromGregorian(2024, 6, 21) // UTC+8
const jp = JapaneseDate.fromGregorian(2024, 6, 21) // UTC+9
const kr = KoreanDate.fromGregorian(2024, 6, 21) // UTC+8:30/9, ๋จ๊ตฐ๊ธฐ์
const vn = VietnameseDate.fromGregorian(2024, 6, 21) // UTC+7/8
์ฐธ๊ณ : ์๊ฐ๋ ์ฐจ์ด๋ก ์ธํด ๊ฐ์ ์๋ ฅ ๋ ์ง๊ฐ ๋ค๋ฅธ ์ญ๋ฒ์์ ๋ค๋ฅธ ์๋ ฅ ๋ ์ง์ ํด๋นํ ์ ์์ต๋๋ค.
import { ChineseDate, solarTermName } from 'chinese-lunar-date'
ChineseDate.solarTerm(5, 2024) // ์ฒญ๋ช
solarTermName(3, 'ko-KR') // "๊ฒฝ์นฉ"
const date = ChineseDate.fromGregorian(2024, 4, 4)
date.getSolarTermName('ko-KR') // "์ฒญ๋ช
"
import { ChineseDate } from 'chinese-lunar-date'
ChineseDate.festivalDate('spring', 2024) // ์ถ์
ChineseDate.festivalsInYear(2024, 'ko-KR')
import { getLocale, availableLocales } from 'chinese-lunar-date'
const loc = getLocale('ko-KR')
loc.zodiac // ["์ฅ", "์", "ํธ๋์ด", "ํ ๋ผ", "์ฉ", "๋ฑ", "๋ง", "์", "์์ญ์ด", "๋ญ", "๊ฐ", "๋ผ์ง"]
loc.solarTerms // ["์
์ถ", "์ฐ์", "๊ฒฝ์นฉ", ...]
| Token | ์ถ๋ ฅ | ์ |
|---|---|---|
{Ygz} |
์ฐ๊ฐ์ง | ็ฒ่พฐ |
{Z} |
๋ | ์ฉ |
{Mname} |
์๋ช | 5์ |
{Dname} |
์ผ๋ช | ์ด์ก |
{L} |
์ค๋ฌ ํ์ | ์ค |
{GY} |
์๋ ฅ ์ฐ | 2024 |
{Wname} |
์์ผ | ์์์ผ |
์ ์ฒด Token ๋ชฉ๋ก์์ฌ์ฉ ์๋ด์๋ฅผ ์ฐธ์กฐํ์ธ์.
<script src="dist/chinese-lunar-date.iife.js"></script>
<script>
const date = ChineseDate.ChineseDate.fromGregorian(2024, 6, 21)
console.log(date.formatFull('ko-KR')) // "๊ฐ์ง์ฉ๋
5์์ด์ก"
</script>
npm install chinese-lunar-date
npm run build # ESM + CJS + IIFE ์ปดํ์ผ
npm run build:types # .d.ts ํ์
์ ์ธ ์์ฑ
npm run test # ํ
์คํธ ์คํ
์ฌ์ฉ ์ค ๋ฌธ์ ๊ฐ ๋ฐ์ํ๊ฑฐ๋ ๊ธฐ๋ฅ ์ ์, ๋น์ฆ๋์ค ํ๋ ฅ ๋ฑ์ด ํ์ํ์ ๊ฒฝ์ฐ ์ด๋ฉ์ผ๋ก ์ฐ๋ฝํด ์ฃผ์ธ์๏ผ
๐ง gyfinjava@163.com
MIT License
Copyright (c) 2025 ๅไบฌ้้็งๆๆ้ๅ ฌๅธ (้ญ็ๅณฐ, ๅด็ผ)