3 ms·
Having read the cookbook [1], and wow that's a complex API out there. I can see that there will be a `Temporal Light` to allow us to do `now().startOf('month')`
by yilugurlu 4y ago
Having read the cookbook [1], and wow that's a complex API out there. I can see that there will be a `Temporal Light` to allow us to do `now().startOf('month')` like calls.
[1] https://tc39.es/proposal-temporal/docs/cookbook.html https://tc39.es/proposal-temporal/docs/cookbook.html
- moogly 4y agoWouldn't this work? const firstInMonth = Temporal.Now.with({ day: 1 });
- chrismorgan 4y agoCorrection: Temporal.Now.plainDateISO().with({ day: 1 }) Today (2022-10-10 on my computer), that’ll get you a PlainDate representing 2022-10-01. The “ISO” in there identifies the calendar. Want to know what the first of the current month in the Hebrew calendar is? Temporal.Now.plainDate("hebrew").with({ day: 1 }) And that gives you 2022-09-26[u-ca=hebrew].