Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
This server class provides methods for performing operations on to operate SimpleSchedule objects, such as for example, getting schedule name; determining , determining if the current time value is working time or not or setting time zone for the schedulematches with working time, and returning the difference between two time values.
SimpleSchedule(id, timeZoneTitle)
Instantiates a new SimpleSchedule object.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
id | String | Y | N |
timeZoneTitle | String | N | 'UTC' |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
const schedule = new SimpleSchedule('157165292607666710', 'UTC'); |
duration(startDateTime, endDateTime)
This method determines elapsed time in the number of seconds in the schedule between two date-time datetime values, using based on the schedule time zone or, if not specified, the session time zone.
Note |
---|
Passed dateTime values should be in the schedule. For checking use isInSchedule(datetime) method. |
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
startDateTime | SimpleDateTime | Y | N |
endDateTime | SimpleDateTime | Y | N |
Return:
Type | Description |
---|---|
SimpleDuration | The difference between the two time values. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
const startDatetime = new SimpleDateTime('2019-10-25 08:00:00'); const endDatetime = new SimpleDateTime('2019-10-29 08:00:00'); const schedule = new SimpleSchedule('157165292607666710'); const duration = schedule.duration(startDatetime, endDatetime); ss.info(duration.getValue()); |
load(sysId, timeZoneTitle)
This method initializes a schedule by the sys_id.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
sysId | String | Y | N |
timeZoneTitle | String (empty string by default) | N | '' |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
const schedule = new SimpleSchedule(); schedule.load('157165292607666710'); |
getname()
This method returns the name of the defined schedule name.
Return:
Type | Description |
---|---|
String | The schedule name. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
const schedule = new SimpleSchedule('157165292607666710'); ss.info(schedule.getName()); // Info: 8x5 excluding Russian Holidays |
isValid()
This The method determines checks if the specified schedule is valid.
Return:
Type | Description |
---|---|
Boolean | This method returns TRUE if the schedule is valid; otherwise, it returns FALSE. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
const schedule = new SimpleSchedule('157165292607666710'); ss.info(schedule.isValid()); // Info: true |
isInSchedule(datetime)
This method determines if checks whether the current schedule includes the given datetime is within the current scheduleor they do not match.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
datetime | SimpleDateTime | Y | N |
Return:
Type | Description |
---|---|
Boolean | This method returns TRUE if the specified datetime is in schedule; otherwise, it returns FALSE. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
const datetime = new SimpleDateTime(); const schedule = new SimpleSchedule('157165292607666710'); ss.info(schedule.isInSchedule(datetime)); // Info: false |
setTimeZone(timeZoneTitle)
This method sets a defines which time zone is to be applied to the current schedule.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
timeZoneTitle | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
const schedule = new SimpleSchedule('157165292607666710'); schedule.setTimeZone('US/Central'); |
whenNext(datetime, timeZoneTitle)
This method determines how much time (in seconds) is returns the number of seconds left until the next schedule item starts.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
datetime | SimpleDateTime | Y | N |
timeZoneTitle | String | N | '' |
Return:
Type | Description |
---|---|
SimpleDuration | The SimpleDuration object |
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
const startDatetime = new SimpleDateTime('2019-10-25 08:00:00'); const schedule = new SimpleSchedule('157165292607666710'); ss.info(schedule.whenNext(startDatetime)); |
whenWillExpire(startDateTime, finalWorkingSeconds)
This method determines the time after working seconds value specified in the finalWorkingSeconds parameter passes.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
startDate | SimpleDateTime | Y | N |
finalWorkingSeconds | Integer | Y | N |
Return:
Type | Description |
---|---|
SimpleDateTime | The SimpleDateTime object |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
const startDatetime = new SimpleDateTime('2019-10-25 08:00:00'); // UTC datetime const finalWorkingSeconds = 600; // 10 minutes const schedule = new SimpleSchedule('157165292607666710'); // schedule ID ss.info(schedule.whenWillExpire(startDatetime, finalWorkingSeconds).getValue()); // Info: 2019-10-25 08:10:00 |
Table of Contents | ||||
---|---|---|---|---|
|