Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 15x 1x 1x 12x 12x | import { addMonths, startOfYear } from "date-fns" import { localeFormat } from "./locale-format" /** * * @param {Date} mo - Month * @param {string} format - Format of the month * * @returns {Date[]} */ export const buildMonthDropdown = (mo, format) => { const yrStart = startOfYear(mo) return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map((_, i) => { const value = addMonths(yrStart, i) return { value, text: localeFormat(value, format) } }) } |