Module: calendar-controller

Controller functions to get dates using a frequency format
Version:
  • 0.0.1
Author:
  • Danilo Del Busso

Methods


<inner> formatDatabaseDate(dateString)

Parameters:
Name Type Description
dateString a date of the form "20190323"

<inner> getMondayOfWeek(date)

Gets the date object of the monday of the relative week
Parameters:
Name Type Description
date Date any day of any week
Returns:
relative monday date
Type
Date

<inner> getNextDate(frequency, startingDate)

Get the next date
Parameters:
Name Type Description
frequency string the frequency in the given format
startingDate date the starting date from which to calculate the next date
Example

Example usage of getNextDate with X-D notation.

// returns Date object of value 2018-01-04T00:00:00.000Z
getNextDate('3-D', new Date(2018, 0 , 1));

<inner> getNextDates(frequency, startingDate)

Get all the next dates based on the frequency notation. It does NOT return the original date
Parameters:
Name Type Description
frequency string the frequency expressed as frequency notation
startingDate Date the starting date (not included in the result)
Returns:
an array containing the next dates but not the given starting date
Type
array.<Date>

<inner> getNextWeek(week)

Gets the dates of the next week.
Parameters:
Name Type Description
week
Returns:

<inner> getPreviousWeek(week)

Gets the dates of the previous week.
Parameters:
Name Type Description
week
Returns:

<inner> isHoliday(date)

Check if a date is a holiday in the UK
Parameters:
Name Type Description
date date the date to check

<inner> stringIsInteger(str)

Check if given string is an integer
Parameters:
Name Type Description
str string
Returns:
true if string is an integer
Type
boolean

<inner> validDate(date)

Check if date is valid
Parameters:
Name Type Description
date date the date