v144 · JavaScript

PlainDate Playground

Temporal.PlainDate represents a calendar date with no time and no time zone — just year, month, day. Compared to Date, months are never zero-indexed, arithmetic is non-mutating, and comparison uses .compare() instead of coercion. Explore the operations interactively.

Feature detection: checking…

Temporal type hierarchy

Click a type to see what it represents.

Click a type card above to see its description and example.

PlainDate operations

Add / subtract a duration

Press Calculate

Difference between two dates

Press Calculate

Sorting dates (compare)

Press Sort

Date vs Temporal — the classic gotchas

Date (legacy)
Temporal.PlainDate
// Temporal.PlainDate — no time, no timezone, no surprises
const today = Temporal.Now.plainDateISO();
// → PlainDate { year: 2026, month: 6, day: 1 }  (1-indexed month!)

// Add duration (non-mutating — returns new value)
const future = today.add({ months: 3, days: 15 });

// Difference between dates
const diff = today.until(future, { largestUnit: 'months' });
// → Duration { months: 3, days: 15 }

// Compare (safe for array.sort, no Date coercion bugs)
const dates = ['2026-12-25', '2026-01-01', '2026-06-15']
  .map(s => Temporal.PlainDate.from(s))
  .sort(Temporal.PlainDate.compare);

// Day-of-week (1=Monday, 7=Sunday — ISO, no 0=Sunday confusion)
console.log(today.dayOfWeek);  // 1 = Monday

see also