Utilities
The calendar comes with its utilities, making it easy to work with date formatting.
There are 4 utilities in total, and they are functions that can be used anywhere in your code, even without the calendar.
parseDates(dates: string[])
— Takes an array of date ranges using a delimiter between dates in the string formatFormatDateString ('YYYY-MM-DD')
. Returns an array of dates in the string formatFormatDateString ('YYYY-MM-DD')
.
getDateString(date: Date)
— Takes a date of typeDate
. Returns the date in the string formatFormatDateString ('YYYY-MM-DD')
.
getDate(date: FormatDateString)
— Takes a date in string format, e.g.,FormatDateString ('YYYY-MM-DD')
. Returns a date of typeDate
.
getWeekNumber(date: FormatDateString, weekStartDay: WeekDayID)
— Takes a date in string formatFormatDateString ('YYYY-MM-DD')
and the week start day, specifically itsid
of typenumber
from 0 to 6. Returns an object{ year: yearNumber, week: weekNumber }
for the date specified in the arguments.