npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@kokr/date

v0.4.0

Published

Provides utilities for Korean dates. 날짜 관련 유틸리티를 제공합니다. 공휴일, 절기, 그리고 잡절 정보를 확인하고, 영업일 기준 날짜 계산을 지원합니다.

Downloads

60

Readme

koKR - date

한국의 공휴일, 기념일, 24절기 및 잡절을 제공합니다. 공휴일 정보는 외부 API를 통해 가져오며, 라이브러리 업데이트 없이도 항상 최신 정보를 가져올 수 있습니다. 또한, Web Store API를 활용(Node.js의 경우 shim-webstore 적용)하여 하루단위로 캐싱처리하기 때문에 굉장히 빠르게 사용가능합니다.

@koKR date는 distbe/holidays의 공휴일정보를 사용하고 있고, distbe/holidays는 공공데이터포탈의 공휴일 정보를 활용하고 있습니다.

설치

npm install @kokr/date

만약, Deno를 사용한다면 아래와 같이 import 할 수 있습니다.

import {} from "https://deno.land/x/kokr/date/mod.ts";

사용법

공휴일 가져오기

년도를 입력하면 해당 년도의 모든 공휴일, 기념일, 24절기 및 잡절 정보를 가져옵니다. 자세한 내용은 하단의 데이터 구조를 참고하세요.

import { getHolidays } from "@kokr/date";

// 공휴일 정보 가져오기
const dates = await getHolidays(2022);
/*
[
  {
    "date": "2022-01-01",
    "name": "새해",
    "holiday": true,
    "remarks": null,
    "kind": 1,
    "time": null,
    "sunLng": null
  },
  {
    "date": "2022-01-05",
    "name": "소한",
    "holiday": false,
    "remarks": null,
    "kind": 3,
    "time": "18:14",
    "sunLng": 285
  },
  ...
]
*/

영업일 계산

공휴일(토요일, 일요일, 기념일)을 제외한 영업일을 계산합니다.

import { getNextBusinessDay } from "@kokr/date";

const date = await getNextBusinessDay("2022-01-01", 10);

공휴일 여부

공휴일(토요일, 일요일, 기념일)인 경우, true를 반환합니다.

import { isHoliday } from "@kokr/date";

const holiday = await isHoliday("2022-01-01"); // true

데이터 구조

공휴일 상세정보 타입(DateInfo)

| 속성 | 타입 | 설명 | | ------- | ------------------ | --------------------------------------------------------------------- | | date | string | 공휴일 날짜 (YYYY-MM-DD) | | name | string | 공휴일 이름 | | holiday | boolean | 공휴일 여부 | | remarks | string | null | API에서 주는 정보, 해당 기념일에 대한 기타 설명이 포함된 경우가 있음. | | kind | DateKind | 공휴일인지, 기념일인지, 24절기인지.. enum 참고 | | time | string | null | HH:mm 정확한 표준 시간, DateKind.SolarTerms(24절기) 경우 반환 | | sunLng | number | null | 태양황경(도), DateKind.SolarTerms(24절기) 경우 반환 |

공휴일 종류 (DateKind)

| 값 | 설명 | 예시 | | ------------- | ------ | ---------------------------------------- | | Holiday | 공휴일 | 설날, 대통령선거일, 추석 (대체공휴일) 등 | | Anniversary | 기념일 | 스승의 날, 국군의 날 등 | | SolarTerms | 24절기 | 입춘, 경칩 등 | | Sundry | 잡절 | 정월대보름, 초복, 중복 등 |

API

API 문서 보기