Option to parse date inputs with Moment

I feel like the option to use an object to insert into the DB is a good idea, but then the way a Form returns it's data, is not that helpful.
image

I wish that the Date inputs would have their value be correct for insertion.
image
So I don't have to convert string dates into real dates.

I propose an option to have the date be parsed by Moment behind the scenes and return a proper ISO date string for the database.

Hmm... Maybe a box for timezone? This might not be as simple as I thought...:thinking:

Hi @khill-fbmc!

I love the idea, but yes things could get messy with the timezones :sweat_smile:

I can definitely make a feature request for this and see what our engineering team says. They might have further questions.

I wonder if it would make sense to have the dates generate in local time but then have the timezone modify them based on an option in the GUI

To clarify, what string manipulation/conversion do you have to do to the string date "2024-08-15" to prepare it for insertion into the database?

Are you wanting to insert a Moment object instead of the string?

to be honest, in trying to make a recreation of my issue... I can't.

I was getting frustrated at some point that using {{ form.data }} wasn't working and I was confused why that would be a feature if the fields didn't provide their data in the correct format.

So, I am not sure where I was going with my question.

Hi @khill-fbmc! The Date component has new Date() has its default value, so its initial value is something like 2024-08-29T15:49:38.151-0700, but when you select a new date from the picker it sets it to something like 2024-08-01 (since there is no time associated with the date picker).

The Date Time component, by contrast, has a value like 2024-08-07T00:45:00.000 since you select a time instead of just a date.

What is the format you're expecting to be able to write to the database?

1 Like

It might have been an issue when I have an optional date field in my form...

I think I might have had an input like date1.value = "" because it was cleared, or optional.

so then {{ form.data }} would have an empty string for date1. The DB was crying that "" is not a valid date, but I must have jumped over the fact that I might need to trim the props or convert "" to null before I send it.

2 Likes