# Temporal : JS의 새로운 Date Time API

> Clean Markdown view of GeekNews topic #4523. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=4523](https://news.hada.io/topic?id=4523)
- GeekNews Markdown: [https://news.hada.io/topic/4523.md](https://news.hada.io/topic/4523.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2021-06-29T10:54:21+09:00
- Updated: 2021-06-29T10:54:21+09:00
- Original source: [2ality.com](https://2ality.com/2021/06/temporal-api.html)
- Points: 9
- Comments: 0

## Topic Body

- 기존 자바스크립트의 날짜/시간 API가 너무 사용하기 어려워서 새로 제안중인 API : 현재 Stage 3

- 글로벌 변수인 Temporal 을 통해서 접근 가능

ㅤ→ 모든 객체는 Immutable

ㅤ→ 타임존(IANA 기반) 및 비-그레고리안 달력 지원 (한국의 단기 포함)

ㅤ→ 1월이 Month 1 임

ㅤ→ Wall-Clock(로컬) 시간 과 Exact(UTC) 시간 을 구분

ㅤ→ 타임존 없는 Plain 시간 지원

- 예

ㅤ→ 현재 UTC 시간 : Temporal.now.instant().toString()

ㅤ→ 현재 로컬 시간  : Temporal.now.zonedDateTimeISO('Asia/Seoul').toString()

ㅤ→ 현재 타임존 : Temporal.now.timeZone().toString()

ㅤ→ Temporal.Duration.from({hours: 3, minutes: 45})

ㅤ→ 기존 Date 와 변환

ㅤㅤconst legacyDate = new Date('1970-01-01T00:00:01Z')

ㅤㅤlegacyDate.toTemporalInstant() 또는 Temporal.Instant.fromEpochMilliseconds(legacyDate.getTime())

## Comments



_No public comments on this page._
