Skip to main content

currentDate

The function returns a moment object with the current date from the Moment.js external library.

Importing module

To use the currentDate function, import the dateTime.sc module via the require tag at the beginning of the main.sc file:

require: dateTime/dateTime.sc
module = sys.zb-common

How to use

In the following example, the bot displays a message about the current day of the week. The format method converts the output to a string.

state: Weekday
intent!: /Weekday
script:
$temp.date = currentDate();
a: Today is {{$temp.date.format("dddd")}}.