[🦄 New plugin] - Better Date Parser

Key Features:

  • Automatic date/time extraction from user input like messages, notes, or descriptions.
  • Handles time zones & loacles for global apps, ensuring accurate date handling across regions.
  • Server-side action to parse dates from the backend (costs about 2 WU) (or from the front-end if you really want to)
  • Custom date format detection that allows you to either extract automatically, or specifcy the date/time structure, useful when you know how it is always structured.

Use Cases:

  • Automatically pull dates from free text (e.g., “Let’s meet on July 16 at 3PM”).
  • Convert any ‘text’ date (that Bubble can’t deal with) back into a date/time value useful for Bubble.
  • Handle dates in different languages and time zones with ease.

Plugin page: Better Date Parser Plugin | Bubble

Demo page: https://nquplugins.bubbleapps.io/version-test/betterdateparser

Demo editor: nquplugins | Bubble Editor

7 Likes

Damn you saved me a minute :slight_smile:

Was planning on adding this to my toolkit but never had the time.

Great job.

+1 installed

1 Like

image

^ only useful plugins*

I’ve tested it with all the edge cases I can think of but if anyone finds any bugs hit me up and I’ll deal with it…

1 Like

some feedback after a quick look at the code:

  • from the code: //If time is not specified in the dateTemplate, default to 00:00 luxon does that for you already (e.g. luxon.DateTime.fromFormat("September 11 2024", "LLLL dd yyyy"); is already a date with time Wed Sep 11 2024 00:00:00 GMT+0100, plus the test for hasTime will return true even if one of the characters is included in your custom templating escape system but then it’s removed from the final template
  • your custom regex parsing is actually not 100% compatible with luxon tokens for parsing, some tokens are not supported in luxon (e.g. ZZZZ) and others are supported in luxon but missing in yours (e.g. EEEE luxon.DateTime.fromFormat("September Wednesday 11 2024", "LLLL EEEE dd yyyy") is correctly parsed by luxon, but in the demo page it’s not). in both cases the plugin returns no parsed date without providing any error.
  • a complete lack of error communication sets you up for a really bad developer experience, expecially when trying to debug unparsable templates. luxon returns some nice errors and it can be very helpful to either expose them in a plugin variable to use in the editor or at least enable debug logs in preview mode.
1 Like

Thank you! Will take a look and improve these! For error handling, I planned for people to just use the demo to debug things live, but can see that extra info might be helpful!

On the time defaulting to 00:00 - when testing, the time was defaulting to 12:00 in UTC or the specified timezone, hence adding this. Don’t know why that was happening if Luxon also defaults it to 00:00, because it wasn’t before. I changed from moment.js → Luxon, so maybe it’s a remnant of that which didn’t default.

For certain tokens not being handled, it may be because they’re formatting tokens rather than standalone tokens. Would probably make sense to add these too.

1 Like

This has been updated with:

  • new error state
  • improved token handling including formatting stokens
  • couple of code optimisations
  • for the one person that has installed it, it is backward compatible
1 Like

I cannot get this to work, keep getting ‘No matches found for the given date template’

I have tried MANY different tweaks and it’s a basic dd/mm/yyyy I need converting.

Hey, I’ve responded to your email already, I’ll post it here:

What date format does your API return? What is Show Date’s raw content? Can you give a few examples?
Thanks!
George

You can try using dd/MM/yyyy - dd/mm/yyyy is day/minutes/year

You can read the docs here for more info:

Thanks for the reply, appreciated.

I still get errors: No matches found for the given date template.

Sample XML data:

<show id="13050" sortby="ShowDate" campingfull="0" showfull="0" cancelled="0" showtypecolor="#006600">
<showname>Wallingford DTC Agility Show</showname>
<clubname>Wallingford DTC</clubname>
<showdate>17/04/2027</showdate>
<showend>18/04/2027</showend>
<closingdate/>
<county>7</county>
<schedulefilename> </schedulefilename>
<venuedetails>Newbury, RG18+9QZ</venuedetails>
</show>

This is how the API proceses the XML - I have set the dates here as text as if they are dates bubble can’t process them

Plugin action set up

Can you share a screenshot of the logs for this workflow (or invite support@notquiteunicorns.xyz to the test version of the app)?

If Show Date = 17/04/2027 then what you’ve done will be working, which means Show Date is probably not equal to 17/04/2027.

I can see that the Show date is not being passed to your API workflow when you schedule it.

That means this value is being treated as empty:

You can attempt to reinitialize your API call and verify what the response is like to ensure that Show date is never empty.

Amazing! Thank you!!

The issue was the main API was still trying to bring these in as dates, in the initialise feed the dates needed to be text,

Thanks for this plugin George, it’s really useful! I’m trying to use it with a date stored as a Unix timestamp in milliseconds, but I can’t seem to get it to work. Does it support this format?

1 Like

Are you trying to go from unix timestamp to Bubble date in the element, or the action?

1 Like

Thanks for being that fast! Yes I’m trying to go from unix timestamp to Bubble date in the element :slight_smile:

Just added support @tomvigneres

Provide no date template and you’ll be good

1 Like

It works, you are the best, thank you!