micro-tasks

date

Registers the methods of the module date in microTasks.

date~date.getDate() ⇒ 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)

date~date.getNow() ⇒ boolean

Returns: boolean - Returns now date timestamp.
Example

microTasks.taskRun([{
  method: 'date.getNow',
  resultPath: 'now'
}])
// payload.now = 1511284457000

date~date.isLaterThanNow(date) ⇒ 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

date~date.isBeforeThanNow(date) ⇒ 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

date~date.toDate(date)

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)

date~date.toMidnight(date)

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

date~date.toTimestamp(date)

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