globalbrain / sefirot

Global Brain Design System.
https://sefirot.globalbrains.com
MIT License
151 stars 12 forks source link

[Day] Add helper method to generate `Ymd` and `Hms` from `day` object #445

Closed kiaking closed 7 months ago

kiaking commented 7 months ago

Would be nice to have a function that can generate Ymd and Hms from the day object 😳

const d = day() // Say today is 1985-10-10

createYmdFromDay(d)

/*
 * Note that we must add 1 to the month because
 * `day.month()` starts from 0 but Ymd needs 1.
 * {
 *   year: 1985,
 *   month: 10,
 *   date: 10
 * }
 */