I have trawled the docs, but cannot find a a helper to reset the time of a Luxon DateTime.
I can start with a standard date:
export const getDateOnly = (date: Date = new Date()) => new Date(
date.getFullYear(),
date.getMonth(),
date.getDate()
)
export const today = () => DateTime.fromJSDate(getDateOnly());
but this seems like a common scenario and I might have just missed it?
Reposting as answer for future reference.
https://moment.github.io/luxon/api-docs/index.html#datetimestartof
With example:
export const today = () => DateTime.now().startOf('day');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With