getMonths

This function returns an array of month names.

Parameters

  • short (boolean, default false):

    • If true, the function returns abbreviated month names (e.g., 'Jan', 'Feb').

    • If false, it returns full month names (e.g., 'January', 'February').

Returns

  • An array of month names based on the provided parameter

getMonths()
// ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']

getMonths(true)
//['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

Last updated