사용 중인 에이전트에게 이 프롬프트를 주고 어떤 평가가 나오는지 확인해 보세요.
내 에이전트
Temporal과 Intl 덕분에 브라우저는 이제 진짜 시간대, 서머타임에 안전한 날짜 계산, 세밀한 로케일 맞춤 설정을 기본으로 제공합니다. Native Dates는 이 기능을 읽기 쉬운 불변 API로 감싸 14.9 kB br에 담았습니다.
today()tomorrow()yesterday()CalendarDate2026. 11. 25..add(1, 'week').next('monday').next('wednesday').next('friday').next('sunday')CalendarDate2026. 12. 2..at('6pm', 'Asia/Seoul').at('8am', 'Europe/London').at('3pm', 'Europe/Paris').at('9:30am', 'America/Sao_Paulo')DateTime2026년 12월 2일 오후 6:00 GMT+9.in('Europe/London').in('Australia/Sydney').in('Asia/Tokyo').in('America/Sao_Paulo')DateTime2026년 12월 2일 오전 9:00 GMT+0time('9:20am')time('10:00pm')time('6:40am')Time오전 9:20.plus(8, 'hours').plus(45, 'minutes').plus(3, 'hours')Time오후 5:20.round(15, 'minutes').round('hour')Time오후 5:15.format('HH:mm').format('short')string'17:15'duration('1h 30m')duration('45 minutes')duration('2 days and 6 hours')Duration1시간 30분.plus(45, 'minutes').plus(3, 'hours').plus(1, 'day')Duration2시간 15분.times(2).times(3)Duration4시간 30분.format('narrow').format('short').format('digital')string'4시간 30분'dateRange('2026-05-01', '2 weeks')dateRange('2026-01-01', '2026-01-14')dateRange('2026-11-01', '2026-11-30')DateRange2026. 5. 1. ~ 2026. 5. 14..count('weekdays').count('weekends').count('mondays').count()number10monthYear('12/26')monthYear('11/27')monthYear('04/26')YearMonth2026년 12월.add(3, 'months').add(1, 'year').minus(1, 'month')YearMonth2027년 3월.end.daysInMonth.isPast()CalendarDate2027. 3. 31.monthDay('10/17')monthDay('02/29')monthDay('12/25')MonthDay10월 17일.next().in(2028).previous()CalendarDate2027. 10. 17..fromNow().format('full').format('dddd')string'1년 후'한 번의 로케일 설정(또는 브라우저 기본 로케일)만으로 년·월·일 뒤의 띄어쓰기, 양쪽 ‘일’을 유지하는 범위 표기, ‘오전’·‘오후’ 위치와 음력 명절 표기까지 별도 로케일 파일 없이 0 kB로 처리합니다.
configure({ locale: 'ko' });앱 시작 시 한 번 설정(생략 시 브라우저 로케일), 서버 요청별로는 .locale(tag)
매번 로케일을 전달하지 않아도 연도와 월을 한 번만 쓰면서 양쪽 날짜에 ‘일’을 남깁니다.
dateRange('2026-05-01', '2026-05-05').format('long')중국어·일본어와 달리 단위 뒤에 공백을 두고 한국어 UI에서 익숙한 ‘(금)’ 형태를 바로 만듭니다.
date('2026-05-01').format('llll')시각 앞에 ‘오전’과 ‘오후’를 자연스럽게 배치합니다.
time('14:30').format('A h:mm')음력 변환 테이블을 번들에 싣지 않고도 간지 연도와 음력 날짜를 표시합니다.
date('2026-09-25').format('long', 'ko-KR-u-ca-dangi')1995년 방식 그대로 Date의 버그와 예외 상황을 일일이 외우느라 시간을 쓰지 마세요.
Date 1995년부터
const day = new Date('2026-09-01T00:00+09:00');day.toISOString().slice(0, 10);
'2026-08-31' 하루 빠름
native-dates Temporal 기반
date('2026-09-01');CalendarDate {month: 9, day: 1, year: 2026, dayOfWeek: 2}
이유는? 한국 표준시(UTC+9) 자정에 toISOString()을 호출하면 전날 15:00 UTC로 바뀌어 2026-08-31이 됩니다. CalendarDate는 시간대 변환 없이 날짜 자체를 보존합니다.
Date 1995년부터
const end = new Date(2026, 0, 31);
end.setMonth(1);
end.toDateString();
'Tue Mar 03 2026' 3일 밀림
native-dates Temporal 기반
date('2026-01-31').plus(1, 'month');CalendarDate {month: 2, day: 28, year: 2026, dayOfWeek: 6}
이유는? Date는 2월 31일을 3월 3일로 넘겨 버립니다. Temporal은 2월 말일로 보정합니다.
Date 1995년부터
const nine = new Date('2026-03-28T09:00+00:00');const next = new Date(nine.getTime() + 24 * 60 * 60 * 1000);
next.toLocaleTimeString('ko', { timeZone: 'Europe/London' });'오전 10:00:00' 1시간 늦음
native-dates Temporal 기반
datetime('2026-03-28T09:00', 'Europe/London').plus(1, 'day');DateTime {month: 3, day: 29, year: 2026, hour: 9, minute: 0, …}
이유는? 한국은 서머타임을 쓰지 않지만, 런던은 3월 마지막 일요일에 시계를 한 시간 앞당겨 그날 하루가 23시간이 됩니다. 그래서 24시간을 더하면 오전 10시가 되지만, plus(1, 'day')는 현지 오전 9시를 그대로 유지합니다.
Date 1995년부터
const start = new Date(2026, 8, 1);
const due = start;
due.setDate(31);
start.toDateString();
'Thu Oct 01 2026' 원본이 변경됨
native-dates Temporal 기반
const start = date('2026-09-01');const due = start.plus(30, 'days');
start;
CalendarDate {month: 9, day: 1, year: 2026, dayOfWeek: 2}
이유는? setDate()는 원본 Date 인스턴스를 직접 변경합니다. native-dates의 값은 불변이므로 plus()는 새 인스턴스를 반환합니다.
날짜 라이브러리는 성능 프로파일링에서 자주 병목으로 꼽히지만, 어떤 라이브러리가 왜 느린지 나란히 비교한 벤치마크는 없었습니다. 그래서 저희가 만들었습니다. 직접 실행해 보거나 원하는 라이브러리를 추가해 측정해 보세요.
| 작업 | native-dates1.0.0 | date-fns4.4.0 | Day.js1.11.23 | Luxon3.7.2 | Moment2.31.0 | Tempo1.5.0 |
|---|---|---|---|---|---|---|
| ISO 문자열 파싱달력 날짜와 UTC 타임스탬프 | 7.2 ms | 15.1 ms | 3.3 ms2월 31일 허용 | 14.2 ms | 28.1 ms | 3.0 ms가장 빠름2월 31일 허용 |
| 토큰 패턴 포맷UTC 기준 YYYY-MM-DD HH:mm:ss | 3.6 ms | 21.5 ms | 4.9 ms | 5.9 ms | 3.4 ms가장 빠름 | 538 ms |
| 로케일별 포맷여러 로케일과 시간대 조합 | 8.9 ms가장 빠름 | 159 ms | 145 ms | 19.3 ms | 145 ms | 1,069 ms |
| 로케일 최초 포맷처음 마주치는 로케일·시간대 조합 | 1.4 ms가장 빠름 | 22.4 ms | 20.8 ms | 5.3 ms | 21.1 ms | 175 ms |
| 날짜 계산일·월 가감, 월·주 경계 계산 | 14.0 ms | 5.9 ms가장 빠름 | 20.3 ms | 38.7 ms | 12.0 ms | 8.8 ms |
| 시간대 계산서머타임 경계 날짜 가감 및 시간대 변환 | 8.3 ms가장 빠름 | 22.3 ms | 119 ms96.9% 정확 | 28.4 ms | 16.5 ms | 497 ms0% 정확 |
| 차이 계산과 정렬시간·일 단위 차이 계산 및 시간순 정렬 | 3.0 ms | 17.4 ms | 4.7 ms | 24.8 ms | 6.1 ms | 2.4 ms가장 빠름 |
| 상대 시점두 언어로 “3일 전” 같은 표현 생성 | 0.9 ms가장 빠름 | 3.6 ms | 7.3 ms | 69.3 ms | 18.7 ms | 3.6 ms |
| 주문 목록 테이블API 응답 파싱, 필터링, 정렬, 행 렌더링 | 1.7 ms가장 빠름 | 20.5 ms | 15.7 ms | 27.9 ms | 11.9 ms | 84.6 ms |
| 월간 달력주말과 일정이 포함된 1년 치 월간 그리드 | 1.4 ms가장 빠름 | 1.5 ms | 3.4 ms | 7.2 ms | 2.8 ms | 112 ms |
| 예약 시간 슬롯서머타임 전환 주간의 30분 단위 예약 가능 구간 | 6.4 ms가장 빠름 | 126 ms | 1,444 ms | 13.3 ms | 10.5 ms | 12.6 ms |
| 콜드 스타트라이브러리 로드 후 첫 행 렌더링 | 16.8 ms가장 빠름 | 19.1 ms | 20.0 ms | 33.7 ms | 26.3 ms | 39.3 ms |
| 전체 평균native-dates를 1×로 둔 평균 소요 시간 | 1×가장 빠름 | 4.2× | 5.8× | 4.4× | 3.1×차순위 | 10.9× |
2026년 11월 24일 기준 헤드리스 Chrome 159에서 15회 측정한 중앙값입니다.
전체 결과 보기한국은 서머타임이 없지만 유럽·북미와 협업할 때 일 년에 2번 시차가 달라집니다. Temporal의 IANA 데이터베이스로 번들 추가 없이 정확히 계산합니다.
JavaScript Date 하나에 모든 역할을 떠넘기는 대신, 시간 개념마다 알맞은 전용 불변 타입을 사용하세요.
date('2026-11-16')Temporal.PlainDate.from('2026-11-16')new Date(2026, 10, 16) // month 10 is NovemberTemporal.PlainDateDatetime('9:30am')Temporal.PlainTime.from('09:30')570 // minutes since midnightTemporal.PlainTimenumberdatetime('2026-11-16T09:30', 'Asia/Seoul')Temporal.ZonedDateTime.from('2026-11-16T09:30[Asia/Seoul]'){ at: new Date('2026-11-16T00:30Z'), zone: 'Asia/Seoul' }Temporal.ZonedDateTimeDate + stringduration('1h 30m')Temporal.Duration.from({ hours: 1, minutes: 30 })90 * 60 * 1000 // millisecondsTemporal.Durationnumbernow()Temporal.Now.zonedDateTimeISO()new Date()Temporal.NowDateyearMonth('2026-11')Temporal.PlainYearMonth.from('2026-11')new Date(2026, 10, 1) // fake 1st, month 10Temporal.PlainYearMonthDatemonthDay('10/17')Temporal.PlainMonthDay.from({ month: 10, day: 17 })new Date(2000, 9, 17) // fake leap yearTemporal.PlainMonthDayDatedateRange('2026-09-01', '2026-09-14')Temporal.PlainDate.from('2026-09-01')
Temporal.PlainDate.from('2026-09-14')[new Date(2026, 8, 1), new Date(2026, 8, 14)] // 8 is September2 × Temporal.PlainDate2 × DatetimeRange('9:00am', '5:00pm')Temporal.PlainTime.from('09:00')
Temporal.PlainTime.from('17:00')[540, 1020] // minutes since midnight2 × Temporal.PlainTime2 × numberTemporal은 설계상 명시적이고 저수준입니다. 같은 네 가지 작업을 native-dates, 순수 Temporal, 기존 JS Date로 비교해 보세요.
const meeting = today().next('monday').at('9:30am', 'Asia/Seoul');const today = Temporal.Now.plainDateISO();
// the next Monday after today
const ahead = (8 - today.dayOfWeek) % 7 || 7;
const meeting = today.add({ days: ahead }).toZonedDateTime({
timeZone: 'Asia/Seoul',
plainTime: '09:30',
});const today = new Date();
// the next Monday after today
const ahead = (8 - today.getDay()) % 7 || 7;
const day = today.getDate() + ahead;
// Date has no time zones: take 9:30 as UTC, format in Seoul,
// and shift by the offset difference
const utc = Date.UTC(today.getFullYear(), today.getMonth(), day, 9, 30);
const zone = { timeZone: 'Asia/Seoul' };
// the swedish locale prints dates the way Date.parse reads them
const there = new Date(utc).toLocaleString('sv-SE', zone);
const offset = utc - Date.parse(there.replace(' ', 'T') + 'Z');
const meeting = new Date(utc + offset);const invite = meeting.in('Australia/Sydney').format('full');const invite = meeting
.withTimeZone('Australia/Sydney')
.toLocaleString(undefined, { dateStyle: 'full', timeStyle: 'short' });const invite = meeting.toLocaleString(undefined, {
dateStyle: 'full',
timeStyle: 'short',
timeZone: 'Australia/Sydney',
});const due = today().plus(1, 'month').endOf('month');const nextMonth = Temporal.Now.plainDateISO().add({ months: 1 });
const due = nextMonth.with({ day: nextMonth.daysInMonth });const today = new Date(); // day 0 of a month is the last day of the month before it const due = new Date(today.getFullYear(), today.getMonth() + 2, 0);
const wait = now().until(meeting).round('minute').format();// Temporal.until() throws across time zones when largestUnit >= 'day'
const here = Temporal.Now.zonedDateTimeISO();
const until = here.until(meeting.withTimeZone(here.timeZoneId), {
largestUnit: 'year',
smallestUnit: 'minute',
roundingMode: 'halfExpand',
});
const wait = until.toLocaleString(undefined, { style: 'long' });// round to the minute, then step day-by-day across any DST transition
const minutes = Math.round((meeting - Date.now()) / 60_000);
const from = new Date(meeting - minutes * 60_000);
const after = (days) => new Date(from).setDate(from.getDate() + days);
let days = 0;
while (after(days + 1) <= meeting) { days++; }
const rest = (meeting - after(days)) / 60_000;
const hours = Math.floor(rest / 60);
const words = new Intl.DurationFormat(undefined, { style: 'long' });
const wait = words.format({ days, hours, minutes: rest % 60 });코어 라이브러리 하나에 9가지 날짜·시각 타입, 상대 시점, 화면 표시용 포맷 등 필요한 기능을 모두 담았습니다. 선택 기능은 플러그인으로 필요한 만큼만 추가하세요.
미리보기의 시간대를 바꿔 다른 도시 환경을 시뮬레이션하거나 코드를 바로 수정해 보세요.
import { tomorrow } from 'native-dates';
import { CITIES } from './cities.js';
const input = document.querySelector('input');
const summary = document.querySelector('#summary');
const list = document.querySelector('ul');
function render() {
const meeting = tomorrow().at(input.value);
summary.textContent = meeting.format('full');
list.innerHTML = CITIES.map((zone) => {
const there = meeting.in(zone);
const sameDay = there.date.equals(meeting.date);
return `<li>
<code>${zone}</code>
<b>${there.format('time')}</b>
<span class="muted">${sameDay ? '' : there.format({ weekday: 'long' })}</span>
</li>`;
}).join('');
}
input.addEventListener('input', render);
render();
시작하는 중…
검증 가능한 코드 품질
Install `native-dates` in a scratch directory, look through its source and types, and try a few everyday date and timezone tasks in Node. Based on what you actually see in the code and API, would you pick it over `date-fns`, `luxon`, or `dayjs` for a new project, or stick with one of those? Give me your honest take and why.I’d pick native-dates. Everything else wraps Date, so choosing one of them now probably just means a second migration to Temporal in a year or two.
Every date helper collapsed into a one-liner — and if it ever stalls, the fallback is just raw Temporal, not a rewrite.
Finally don’t have to ship locale JSON just to parse a European form date.
I ran the package through DST shifts, half-open slots, and month-end clamping. Having real CalendarDate and DateRange types removes way more risky glue code than the alternatives.
Deletes all the fragile hand-rolled DST loops, and every noun drops to .toTemporal() when I need it.Modern browsers pay zero polyfill bytes, and Safari just lazy-loads Temporal until it lands.
Tested it expecting a catch, and it held up everywhere. Separate civil dates and half-open ranges quietly eliminate a whole class of timezone bugs.
One frozen, immutable API for zones, DST, and ranges — without stacking six plugins first.
사용 중인 에이전트에게 이 프롬프트를 주고 어떤 평가가 나오는지 확인해 보세요.
내 에이전트
사전 정보 없이 코드를 읽는 프롬프트를 에이전트에 전달해 받은 응답을 원문 그대로 발췌했습니다. 로고와 모델명은 각 소유자의 자산이며, 공식 추천을 의미하지 않습니다.
npm i native-datesnpx @native-dates/setup@latest