-
-
Notifications
You must be signed in to change notification settings - Fork 549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time should not be saved if time is disabled on Date field #3118
Conversation
…e is enabled or not
Nice. That seems to do the trick just fine! Saves without time when |
YES! @damcclean you're the hero we need. Really appreciate you taking the time to look into this! ❤️ |
You are very welcome! |
Hmmmm maybe I spoke to soon, I'm still having the time saved on a field
Results in: Naturally theres also no way to clear the date, likely due to this bug: As far as I can tell theres still no differentiation between time enabled & time required? |
In the field you shared, you have the time enabled so I'd expect the time to also save. But basically what you'd like is if there's no time provided in your date and time required is set to false, it should just save the date and no time? |
Yeah, it makes sense, I think I just forgot about that use case. I'll have a look at PR'ing the code to support the time required setting (after work). |
Oh nice find. Didn't use it either (yet). But def. makes sense to me. |
Amazing! No time stress whatsoever from me! I just appreciate you taking the time to look at it - is all over my head! |
This pull request resolves #2497, where the time would always be saved, even if the
time_enabled
config setting was set tofalse
.The issue seems to have come from the
preProcess
function of the Date fieldtype where it was formatting the date value to one that can then be understood by Moment on the frontend.Essentially, it was just a case of adding a ternary to check if time is enabled, if yes the format will be
Y-m-d H:i
, otherwise it will beY-m-d
.