Class: Schedule

Schedule

Schedule class to hold opening and closing times for parks and rides etc. Supports standard and "special" opening times

new Schedule(options)

Create a new Schedule object
Parameters:
Name Type Description
options Object
Properties
Name Type Description
id String Unique Schedule ID for caching keys

Members


Cache

Get our cache object

Methods


CheckCacheStatus()

Check the cache has been setup. Returns resolved Promise once it is

GetCurrentParkSchedule()

Return today's park schedule This function will take into account park hours going past midnight

GetDate(dateData)

Get schedule data for a specific date
Parameters:
Name Type Description
dateData Object
Properties
Name Type Description
date Moment | String Moment.js date object to fetch schedule data for (or a valid date String to be parsed by Moment JS)
Returns:
scheduleResult Can be false if no data exists for the requested date
Type
ScheduleData

GetDateRange(dateData)

Get schedule data for a range of dates
Parameters:
Name Type Description
dateData Object
Properties
Name Type Description
startDate Moment | String Moment.js date object to fetch schedule data from (or a valid date String to be parsed by Moment JS)
endDate Moment | String Moment.js date object to fetch schedule data from (or a valid date String to be parsed by Moment JS)
Returns:
scheduleResult Can be an empty array if there is no valid data (won't be null)
Type
Array.<ScheduleData>

ReadFromCache()

Read data from cache

RequestCache()

Request a cache to happen at the next best opportunity

SetDate(scheduleData)

Set schedule data for a date
Parameters:
Name Type Description
scheduleData Object
Properties
Name Type Argument Default Description
date Moment | String <optional>
scheduleData.openingTime Moment.js date object (or a valid date String to be parsed by Moment JS). Will use openingTime if this is not supplied
openingTime Moment | String <optional>
Moment.js date object of this day's opening time (or a valid date String to be parsed by Moment JS) (can be ignored if type is Closed)
closingTime Moment | String <optional>
Moment.js date object of this day's closing time (or a valid date String to be parsed by Moment JS) (can be ignored if type is Closed)
specialHours Boolean <optional>
false Is this schedule data part of schedule special hours?
type String <optional>
Operating The schedule type. Normal schedules should always be "Operating", "Closed" or "Refurbishment". Special schedules can be any String (eg. Extra Magic Hours).
Returns:
success Returns true if the operation was a success and the data was actually changed
Type
Boolean

SetRange(scheduleData)

Set a range of dates with the same schedule data
Parameters:
Name Type Description
scheduleData Object
Properties
Name Type Argument Default Description
startDate Moment | String Moment.js date object to start schedule date range (or a valid date String to be parsed by Moment JS)
endDate Moment | String Moment.js date object to end schedule date range (or a valid date String to be parsed by Moment JS)
openingTime Moment | String Moment.js date object of this day's opening time (or a valid date String to be parsed by Moment JS)
closingTime Moment | String Moment.js date object of this day's closing time (or a valid date String to be parsed by Moment JS)
specialHours Boolean <optional>
false Is this schedule data part of schedule special hours?
type String <optional>
Operating The schedule type. Normal schedules should always be "Operating", "Closed" or "Refurbishment". Special schedules can be any String (eg. Extra Magic Hours).
Returns:
success
Type
Boolean

WriteToCache()

Write schedule data to the cache