Registers the methods of the module date in microTasks.
boolean
boolean
boolean
boolean
boolean
Returns: boolean
- Returns current date.
Example
microTasks.taskRun([{
method: 'date.getDate',
resultPath: 'now'
}])
// payload.now = Tue Dec 19 2017 16:24:44 GMT+0100 (CET)
boolean
Returns: boolean
- Returns now date timestamp.
Example
microTasks.taskRun([{
method: 'date.getNow',
resultPath: 'now'
}])
// payload.now = 1511284457000
boolean
Returns: boolean
- Returns if value is later than now.
Name | Type | Description |
---|---|---|
date | date |
date to validate |
Example
microTasks.taskRun([{
method: 'date.isLaterThanNow',
params: 1511284457000,
resultPath: 'isLater'
}])
// payload.isLater = false
boolean
Returns: boolean
- Returns if value is before now.
Name | Type | Description |
---|---|---|
date | date |
date to validate |
Example
microTasks.taskRun([{
method: 'date.isBeforeThanNow',
params: 1511284457000,
resultPath: 'isBefore',
}])
// payload.isBefore = true
Parse a value to JavaScript Date object.
Name | Type | Description |
---|---|---|
date | \* |
value to parse |
Example
microTasks.taskRun([{
method: 'date.toDate',
params: 'Tue Nov 21 2017 18:14:17 GMT+0100',
resultPath: 'date'
}])
// payload.date = Tue Nov 21 2017 18:14:17 GMT+0100 (CET)
Returns a midnight of a date.
Name | Type | Description |
---|---|---|
date | \* |
date |
Example
microTasks.taskRun([{
method: 'date.toMidnight',
params: 'Tue Nov 21 2017 18:14:17 GMT+0100',
resultPath: 'date'
}])
// payload.date = 1511222400000
Parse a Date object to timestamp.
Name | Type | Description |
---|---|---|
date | date |
date to parse |
Example
microTasks.taskRun([{
method: 'date.toTimestamp',
params: 'Tue Nov 21 2017 18:14:17 GMT+0100 (CET)',
resultPath: 'timestamp'
}])
// payload.timestamp = 1511284457000