How to parse a date in text format into Bubble date format

In one of the API calls, I receive a date as text. I need to convert it into Bubble date format.
Arbitrary date/time operator suppose to solve this task but it’s intput field doesn’t allow to use dynamic data.

I used TextToDate plugin which is actually great but can only be used as an element on the page and has no actions/event for workflows.

Are there any other ways to convert a text date into Bubble date format?

I came to the forum to check on exactly the same thing and to see if the arbitrary date/time feature was broken, since it is new to me.

My guess is there is a concern over the way each locality supports date string formatting and if they added support for date coercion (converting a string to a date) that they’d need to make it universal and provide users a consistent and robust way to importing date strings regardless of the users location and browser. For example is it DD/MM/YYYY or MM/DD/YYYY ? You’d need to give users a way to choose the input format much like the output format that exists now. Certainly doable, but it would be an effort on bubble’s part to implement a library and tackle this somewhat low-priority feature. Users can use plugins to solve this issue as well, so its not impossible to deal with.

Plugin solution
If you want to use a plugin, check out date and timezone tools. This includes a date to text element relies on a takes a text type input and will output a date type. The element will refresh that output value if the input changes so essentially acts similar to a ‘state’. I don’t see why you’d need any actions or workflow triggers when using the date this way client-side. The only catch is that it relies on pure JS (and presumably the configuration of the user’s browser) to interpret the date.

If you did want to attempt this with a dynamic expression, its doable, but is incredibly complex to enter and is probably best to store as a state and perform the individual month,day,year steps in a workflow

Dynamic expression for setting a ‘whole date’ on a basic mm/dd/yyyy formatted date:

Arbitrary date/time | Set date to '1/1/1970'
:change month to My Thing's DateText
:extract with Regex | regex = [^\/]+
:item #1
:converted to number
:change day to My Thing's DateText
:extract with Regex | regex = [^\/]+
:item #2
:converted to number
:change year to My Thing's DateText
:extract with Regex | regex = [^\/]+
:item #3
:converted to number
6 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.