Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Latest commit

 

History

History
28 lines (20 loc) · 539 Bytes

date_to_month.md

File metadata and controls

28 lines (20 loc) · 539 Bytes

dates/dateToMonth

Returns the name of the month for the given date.

function dateToMonth(date: Date, short: bool = false): string

Args

date:Date
The date.

short:bool
Return the abbreviated (3 letter) version of the name

Returns

The name of the month for the given date.

Examples

import { dateToMonth } from 'utils/dates';

const date = new Date(2017, 6, 4);
console.log(dateToMonth(date));       // Outputs: "July"
console.log(dateToMonth(date, true)); // Outputs: "Jul"