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

Latest commit

 

History

History
61 lines (53 loc) · 993 Bytes

date_calendar_days.md

File metadata and controls

61 lines (53 loc) · 993 Bytes

dates/dateCalendarDays

Returns an array of all the days in the given date.

function dateCalendarDays(date: Date): array

Args

date:Date
The date to get the days for.

Returns

An array which is padded so the first day (index 0) is always a sunday, and the last day is always saturday. The padding numbers will be negative or greater than the number of days in the given month.

Examples

import { dateCalendarDays } from 'utils/dates';

const date = new Date(2017, 7);
console.log(dateCalendarDays(date));

// Outputs:
//    [ -1,
//      0,
//      1,
//      2,
//      3,
//      4,
//      5,
//      6,
//      7,
//      8,
//      9,
//      10,
//      11,
//      12,
//      13,
//      14,
//      15,
//      16,
//      17,
//      18,
//      19,
//      20,
//      21,
//      22,
//      23,
//      24,
//      25,
//      26,
//      27,
//      28,
//      29,
//      30,
//      31,
//      32,
//      33 ]