I'm trying to create a dialog with different response/action depending on a @sys-date system entity provided by the user. I know I can add conditions such as @sys-date.before('2018-01-24') where the compared value is fixed, but I have not been able to create a conditions that would check if the provided system entity is during today or during yesterday. Best I've tried is @sys-date.before(now().reformatDateTime('dd-MM-yyyy')) but even that does not seem to work like expected.
Asked
Active
Viewed 909 times
1
-
hi and welcome to SO. Please post the code you have tried so far for a better question quality. https://stackoverflow.com/help/asking – messerbill Jan 24 '18 at 13:14
-
Found out a viable way for this, but it needs the caller to supply the dates of today and yesterday as context variables in format yyyy-MM-dd (e.g. 2018-02-01). With these variables in place, you can create a condition such as: `@sys-date.sameOrAfter(context['yesterday_string']) && @sys-date.before(context['today_string'])` – OlliK Feb 01 '18 at 13:03
1 Answers
3
You can find out date for today and yesterday as follows:
{
"context": {
"date_today": "<? new Date().format('yyyy-MM-dd') ?>",
"date_yesterday": "<? new Date((new Date().getTime()) - (24*60*60*1000L)).format('yyyy-MM-dd') ?>"
}
These variables can be used then to compare the date in the system entity. E.g.
@sys-date.before($date_yesterday)

Michal Bida
- 1,316
- 9
- 24