Duaer

Expressions and code

Date transformation methods in Duaer

In a Duaer expression, $now and $today are Luxon DateTime values. Call toDateTime() on a string or number before format, plus, or setZone.

Turn a value into a DateTime first

Date math uses a DateTime, not a plain Date. $now and $today are already DateTime values. Call toDateTime() on a string or a number. Library differences—including toFormat instead of format in the Code node—are in Work with dates using Luxon in Duaer.

{{ $json.createdAt.toDateTime().toFormat("yyyy-MM-dd") }}

Methods and fields on DateTime

  • year, month, day, hour, minute, second, millisecond, quarter, weekNumber, and weekday read one part. monthLong, monthShort, weekdayLong, and weekdayShort are words.
  • toFormat is the formatter used on the convenience page. format() is the expression-only formatter.
  • plus(amount, unit) and minus(amount, unit) add or subtract. startOf(unit) and endOf(unit) move to the start or end of that unit.
  • set({ ... }) changes one part. setZone(zone), toUTC(), and toLocal() change the zone.
  • toISO(), toMillis(), toSeconds(), toString(), toLocaleString(), and toRelative() write a string or a number.
  • diffTo(other) and diffToNow() measure a gap. equals(), hasSame(unit), and isBetween() compare.
  • extract(unit) pulls out a unit. isEmpty(), isNotEmpty(), isInDST, locale, and zone cover emptiness, daylight saving, locale, and zone.
  • setLocale(locale) changes the locale of this value, which affects names such as the month.

Questions

What type is $now in Duaer?

In a Duaer expression, $now and $today are Luxon DateTime values. Call toDateTime() on a string or number before toFormat, plus, or setZone.

Is plus in a Duaer expression the same as in the Code node?

No. A Duaer expression can write plus(7, "days"). Native Luxon in the Code node wants plus({ days: 7 }). format() in an expression maps to toFormat() in the Code node.

In this section