Feature Request Date and/or Time File in Custom Modules

Custom Module offers a Date Time field option, but I would like to also see a separate Date option and a Time option. This would come in handy for user-submitted forms.

While I can work around it by changing the input type from “datetime-local” to “date” or “time”, the system adds unneeded data that then has to be filtered out.

For example, if I use “date” for my input type it automatically sets the time at midnight. When using “time” it sets the date as today’s date. This then needs to be filtered out in order to use/display the data.

Hope that makes sense.

1 Like

Not sure I fully understand your request here.
Custom Module creation forms have a datetime field which you can enter both date and time into:

image

And when displaying that date on the site you’d always be formatting it somehow, so to display just the date part you might do:

{{this.datetime | date: "%D"}}
eg: 2/1/2021

and for just the time part something like:

{{this.datetime | date: "%r"}}
eg: 1:02:00 AM

If you want to collect date and time in seperate fields on the front-end, perhaps you have 2 dummy fields for this which are then combined with javascript into the true hidden datetime field.

You can probably configure a date picker plugin to do the seperate date and time fields in the required format and to make it a nicer UI.

Let us know if I’ve missed your requirements here.

It’s more about the user experience. If all I need is the date, then why ask for time. I have a user submitted custom module and I just need the date. With “datetime-local” They must enter a time or it doesn’t work. So I have to add text to tell them what to enter. Having a date field that doesn’t look at time would help.

I can change the form type to “date” and it works well.

Now my example is for expiry date which comes with other issues. The time is automatically set at 12:00 am if I only use “date” type. but works for other custom fields just fine.

Defaults: Maybe they could set Release date default is 12:00 am the start of the day and the Expiry Date defaults to 11:59 pm the end of the day. This would fix this problem and make it a nice default for the backend admin as well. If they can do that maybe they can change the default Expiry date so that it is tomorrow or the end of this year and not 12/31/9999.

Release Date: I would like to see the Release date in custom modules available as an option to add to the user submitted form as well.

Thanks for the clarification.

I think this is available if you turn on the “Specify item expiry date” option in the custom module settings? (although I have fully tested this)
image
And with this you get 2 fields available:

<label>Expiration Date</label>
<input type="datetime-local" name="prop_ExpiryDate" value="" >
<label>Expires After</label>
<input type="text" name="prop_ExpireAfterDays" value="" >

^ I think this makes sense and most of the time we wouldn’t need to set a specific time.
So would you agree that this would be the core of the Backlog Request here?

^ I assumed that in most cases we don’t want items to expire and hence the year 9999 (effectively never expire).
If the default was tomorrow or even end of year I would think that would be more annoying for most users in majority of cases. Unless I’ve misunderstood what you mean here.

While it gives you the release date option in the admin it does not allow for it on the front end for user submitted. Only the Expiry date or days. For user submitted fields the release date is set immediately. I have tried to add it manually using “prop_ReleaseDate” but it didn’t work.

Good Point, that would probably be and issue. I see in the Backlog someone requested a Today button in the admin like we have in BC. That would take care of it.
`

Ah, gotcha regarding the release date not available on the front end. I misread that.
Perhaps a workaround is to use the ‘requires approval’ setting (so the item doesn’t go live right away) then have a custom field for submitting the desired release date, in which the admin then sets the real release date from that and approves the item.
Or, use liquid conditions to show items based on the custom release date instead.
Not ideal, I know and would still be good to get the real release date field added to user submitted front-end form.

Yes, creating a custom release date field and using liquid condition is what I am doing and it works fine. It would just save some steps.

Thanks!