import 'temporal-extended';
const now = Temporal.Now.zonedDateTimeISO();
now.format('YYYY-MM-DD'); // 2026-06-01
now.strftime('%Y-%m-%d'); // 2026-06-01
now.strftime('Today is: %A'); // Today is: Monday
const tomorrow = now.add({ days: 1 });
now.isBefore(tomorrow); // true
now.isAfter(tomorrow); // falseimport format from 'temporal-extended/format';
import strftime from 'temporal-extended/strftime';
import { isBefore, isAfter } from 'temporal-extended/compare';
const now = Temporal.Now.zonedDateTimeISO();
format(now, 'YYYY-MM-DD'); // 2026-06-01
strftime(now, '%Y-%m-%d'); // 2026-06-01
strftime(now, 'Today is: %A'); // Today is: Monday
const tomorrow = now.add({ days: 1 });
isBefore(now, tomorrow); // true
isAfter(now, tomorrow); // falseimport * as TemporalEx from 'temporal-extended/functional';
TemporalEx.parse('2026-06-01').format('YYYY-MM'); // 2026-06Choose either interface, or use both:
- Extend the Temporal date objects for a convenient highly readable interface.
- Import individual ( tree-shakable? ) functions while leaving the Temporal objects unmodified.
The new JavaScript Temporal API replacement for Date() is pretty nice. It's very precise in its definition, which also makes it very verbose. I happen to like it that way.
While the proposed ( practically official ) API is very thorough and well designed, apparently the committee assumed no one would ever need to output Temporal data to a user interface.
You see, there are these beings called Product Managers... And they like to design user interfaces that don't necessarily conform to ISO spec.
So yeah... We need a general purpose string formatter.
- No automated CI/CD.
- No runtime dependencies. No supply-chain exposure.
- Temporal object extensions are purely additive and do not alter existing behavior.
- But if you're paranoid, you can use the functional interface!
Formatters and parsers
strftime: the venerable formatter from Cformat: fromdayjs/moment.jsparse: fromdayjs
Quality-of-Life Helpers
isBeforeisAfterisBetween- ... more to come
- Add extended formats from moment.js into
format - Add a
unicodeformatter to matchdate-fns - Add more optional helper function
- Add custom parser, based on either regex or format tokens, maybe both