Idea: Dynamic content date selector (calendar drop down)

Would be awesome if it was possible to add a dynamic content field where as a user i'd have the ability to select a date & time from a calendar selector or dropdown menus and that would outpout a date of the following format:

{day} (in relative format, i.e, tomorrow, Monday, Tuesday etc..) at {time} (example: 6pm)

Has anyone figured out how to do this?

@Cedric_Debono, whose done some experiments with this.

1 Like

Hi @Jawad_Sabra,

Here's something I created a while ago that I've been using regularly.

{option="Date"}
{note: trim=yes}

{format="dddd, MMMM Do"}

Date set:

Day: {formtext: name=day; default={time: D}; cols=2}

Month:{formtext: name=month; default={time: M}; cols=2}

Year: {formtext: name=year; default={time: YYYY}; cols=4}

This is the date that will be rendered: {dateset=day&"/"&month&"/"&year}{=dateset}

{endnote: trim=right}

{=catch({time: {=format}; at={=dateset}; pattern=D/M/YYYY}, {time: {=format}})}{formtoggle: default=no} at {formtext: name=hours; default=02; cols=2}:{formtext: name=minutes; default=00; cols=2} UTC{endformtoggle}{=relativeDay}{note} (tick the box to show and modify the time){endnote}

{if: day==({time:D}-1)}{relativeDay=" (Yesterday)"}{else}
{if: day==({time:D})}{relativeDay=" (Today)"}{else}
{if: day==({time:D}+1)}{relativeDay=" (Tomorrow)"}{else}
{relativeDay=""}{endif}{endif}{endif}

You could turn the text fields into dropdown fields — I've tried that too but I've found it cumbersome. Much easier to input the numbers manually.

Hope this helps :slight_smile:

1 Like

Thanks for the response. Seems really cool but I was actually looking for a way to avoid inputting or choosing the dates individually, but rather use a calendar selection and output in human language, I guess it's a bit of an advanced feature for this tool.

Thanks anyway.

It's something we've thought about in the past. But it's difficult to define the feature set for it.

In terms of date/time pickers there are so many different options people might want to set (max date, min date, precision (e.g. resolution of a day, hour, minute, month, etc...), valid dates of the week, point-select/range-select, etc...).

It's hard to say what the right feature set would be that would meet most use cases but not be overwhelming.

Hi @Jawad_Sabra,

Not really. Just needs a bit of thought.

{note: preview=no; trim=right}
{option="Date"}
{format="dddd, MMMM Do"}
{totalDays={time: DD; at={=month}/{=year}; pattern=M/YYYY; shift=>M}}
{days=seq(1,{=totalDays})}
{months=seq(1,12)}
{years=seq(1900,2050)}
{endnote: trim=yes}

{note: trim=yes}
Date set:

Day: {formmenu: name=day; values={=days}; default={time:D}; width=6}
Month:{formmenu: name=month; values={=months}; default={time: M}; width=6}
Year: {formmenu: name=year; values={=years}; default={time: YYYY}; width=8}

This is the date that will be rendered: {dateset=day&"/"&month&"/"&year}{=dateset}

{endnote: trim=right}

{=catch({time: {=format}; at={=dateset}; pattern=D/M/YYYY}, {time: {=format}})}{formtoggle: default=no} at {formtext: name=hours; default=02; cols=2}:{formtext: name=minutes; default=00; cols=2} UTC {endformtoggle}

I've been mulling this over. With the addition of the {time} command's at setting in February (February Development Update), I think this makes sense to add now.

What do people think of this syntax and feature set?

The user interface to select the dates would be this:

Some notes:

Any references to the formdate's value in formulas will always use YYYY-MM-DD format. You can use a {time} command with at to transform it to something else in formulas.

Also if you don't provide the custom field formatter, the output will be in YYYY-MM-DD format in the final insertion.

2 Likes

I think the calendar look would be a welcome addition. Definitely makes snippets leaner both on the backend and on the frontend.

1 Like

Further iterating on this idea.

'The first approach made formatting the selected date (probably an incredibly common flow) too difficult, so I am tweaking the prototype to require an explicit date format like the {time} command has

IMPORTANT: The following snippet contains experimental features that have not launched; may be changed before launched; or may not be launch.

Basic date field:

{formdate: MMM DD, YYYY}

(Note that on insertion the format "MMM DD, YYYY" will be used. In the form preview though a locale specific entry method will be used and not the specified format)

Date field with limited allowed date range:

{formdate: MMM DD, YYYY; start=2020-01-01; end=2020-12-31}

Date field with default date:

{formdate: MMM DD, YYYY; default=2025-01-01}

Date field with nothing selected initially:

{formdate: MMM DD, YYYY; default=}

Using selected dates in formulas:

{formdate: MMM D, YYYY; name=d}

Selected date: {=d}
One week after the selected date: {time: MMM D, YYYY; at={=d}; shift=+1W}

Say I input a start date. I want to generate the date for 4 weeks, 6 weeks, and 8 weeks after the start date. How would you modify the code {dateset=day&"/"&month&"/"&year}{=dateset} to make this happen? I've tried the shift function as you can do with "time" but I got an error.

The upcoming {formdate} command combined with the {time} command would be best for that.

We're in the processing of rolling out a beta of this feature to everyone, if it's not already enabled for you, it should be within a week.

For example:

Start date: {formdate: L; name=start}

4 weeks after: {time: L; at={=start}; shift=4W}
6 weeks after: {time: L; at={=start}; shift=6W}
8 weeks after: {time: L; at={=start}; shift=8W}

Hi all,

Just to update you that we've launched a beta of this feature.

The docs are available here:

Yep, this makes more sense. The calendar shows and we just pick the date we want to enter. Hoping this will be added soon! =)

Hi @Jose_Mar_Glino welcome to the forum! :slightly_smiling_face: This feature is already available, please check out: Text Blaze | {formdate}