Skip to main content

getMonthName()

Returns the name of the month, for the given month number, in a given locale. The default locale is English.

info

Supported locales

At this time, this function supports:

  • English (en)
  • French (fr)

Usage

import { getMonthName } from 'easy-dates';

getMonthName(local, index, short);

Prop types

proptyperequireddefault
localeStringnoen
indexNumbernocurrent month
shortBooleannofalse

Examples

getMonthName("en", 0); // "January"
getMonthName("en", 1); // "February"

getMonthName("fr", 0); // "Janvier"
getMonthName("fr", 1); // "Février"
with short parameter true
getMonthName("en", 0, true); // "Jan"
getMonthName("en", 1, true); // "Feb"

getMonthName("fr", 0, true); // "Jan"
getMonthName("fr", 1, true); // "Fév"
returns current month when no index is provided
getMonthName(); // "April"