Ask a Question & Date Handling Improvements

(John Jackson) #1

We’ve made a bunch of improvements to the ‘Ask a Question’ method.

  • Date functions across the whole platform are now timezone aware. By default, the timezone set in the account’s profile is used.
  • We’ve added more validation types, such as decimal and date/time.
  • All the validations are more forgiving if other words are given around the answer.
  • All validations now standardise the output.
  • The text of the choice itself is now provided along with the answer.

Validations

You now have the following list of validations to choose from:

  • Email Address
  • Integer
  • Decimal (10,00)
  • Decimal (10.00)
  • Date (mm/dd)
  • Date & Time (mm/dd)
  • Date (dd/mm)
  • Date & Time (dd/mm)
  • Time
  • Regex

All of the validations are more forgiving (except for regex). For example, email will accept “My email is name@example.com” and return “name@example.com” as the answer.

Natural Language Dates

For date & time validations, we can now parse freeform responses such as “next tuesday at 10am” or “an hour from now”.

More info about the freeform date formats we support is available here.

Answer Format

  • Date will return a date in the format of 2017-01-14
  • Date & Time will return a datetime in the format of 2017-01-14T12:30:00+10:00
  • Time will return a time in the format of 13:30:00
  • Integer will return 12
  • Decimal (10,00) will return 34,04
  • Decimal (10.00) will return 34.04

Question Choice

For choice questions, the label/text of the choice is now also provided along with the value. In fact, a choice output is provided regardless of whether the question is a choice type or not (if it’s not, the output is empty).

So if a choice question has a choice of Green and a value of 1, the output will include:

  • Choice: Green
  • Value: 1

If only a choice of Green is provided and value is left empty, you will see:

  • Choice: Green
  • Value: Green

Date & Time Handling

Timezone abbreviations are no longer recognized. You must use an offset. For example, -05:00 or +0100.

Date & time validations are timezone aware. They will be parsed (or considered as being) in the timezone set in the account’s profile. If a timezone offset is on the provided string it will take priority over what is set in the profile.

All features in Flow XO are now timezone aware:

  • Ask a Question
  • Date & Time Fields
  • Date & Time Service
  • Wait Service

Backwards Compatibility

To avoid changing the behaviour of current flows, all existing accounts will have their timezone set to UTC.

The timezone setting in the profile was redundant until now. You can easily enable timezone aware date/time parsing by changing the timezone setting in your profile back.

Logs have always been displayed in the browser’s timezone, and that will continue regardless of the setting in the account profile.

The only other change that may affect you is that the output of Ask a Question is now standardized. This is highly unlikely to break any flows, but please check any logic you’re using.

Still to Come

We will shortly be exposing the timezone offset of bot users where the platform provides it.

This will then allow us to use the bot user’s own timezone when parsing dates & times.

Have fun with the new features :beers:

1 Like