Skip to content

parseTossTimestamp — @gj-kit/toss-payments

A public function from @gj-kit/toss-payments/webhook. The signature below is taken directly from the 0.6.1 release declaration.

import { parseTossTimestamp } from '@gj-kit/toss-payments/webhook';
/**
* 토스 웹훅 createdAt 3형식 관대 파서.
*
* 이벤트마다 형식이 다르다(문서):
* 1. 구형 이벤트: `yyyy-MM-dd'T'HH:mm:ss.SSSSSS` — 마이크로초 6자리, 오프셋 없음
* 2. DEPOSIT_CALLBACK/신형 이벤트: `yyyy-MM-dd'T'HH:mm:ss±hh:mm` — 오프셋 형식
* 3. 밀리초 형식(`...ss.SSS`, 오프셋 유무 무관) — 관대 수용
*
* 오프셋이 없는 형식은 **KST(+09:00)로 해석**한다 — 비공식 유도: 토스 문서의
* 오프셋 포함 예시가 전부 +09:00이고 무오프셋 형식과 같은 시스템에서 발신되므로,
* JS 기본(로컬 타임존) 해석은 UTC 서버에서 9시간 어긋난다.
* 초과 정밀도(마이크로초 이하)는 밀리초로 절단한다.
*/
declare function parseTossTimestamp(raw: string): Result<Date, {
readonly kind: 'bad-timestamp';
readonly raw: string;
}>;

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/toss-payments
  • Version: 0.6.1
  • Public entry: ./webhook
  • Source: GitHub