-
Notifications
You must be signed in to change notification settings - Fork 635
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
Using dateTime field to autogenrate Entry title doesn't work on first save from CP #3151
Comments
Sorry not sure I’m following.
In step 2 you are saying to give the Date/Time field a value, but in step 3 you are saying that the Date/Time field should have been left blank. Which is it? |
Sorry, I guess I was a bit unclear: When I save the entry for the first time (step 2), I have set a value to the Date/Time field. When I save the entry, the field is blank, and instead of creating the title based on the date in the Date/Time field, it creates the title (in the format I have specified), but based on the published date instead. Then, with the entry already created, if I set the Date/Time field again (step 3), it saves and retains its value, and the title is updated to reflect the value of the Date/Time field. Here's a couple of screenshots:
Hope that was a bit clearer! |
Ah gotcha, thanks for the clarification. Looking into it… |
Unfortunately I’m not able to reproduce this. Can you please send us a database backup and your composer.json & composer.lock files, so we can try to reproduce it with your install? [email protected] |
Thanks for looking into this, I've sent the DB and the composer files now. Just as a test, I tried adding a new field, and it had the same behaviour. When I tried to use a Date field (without time) it got even weirder – when picking tomorrow's date (July 29 2018), the Date (and title) was saved as June 7 2020(!) |
Tracked this down - this only happens when the entry’s site’s language is different than the user’s preferred language. Fixed for the next release. |
Description
I have an entry type that uses a dateTime field to auto-generate the posts title with this rule:
{showTime | date( 'Y-m-d H:i')}
Somehow it doesn’t work on the first save when creating an entry in Craft (the
showTime
fields is left blank, and the title is set to the publishing date instead). If I set the date/time again, and save the entry, the field retains its value, and the title is corrected to reflect theshowTime
field.When I create entries programatically from a plugin, it works without issue.
I have another entry with a date field (not with time), which is not connected to the title. These entries save correctly and retain the value, also on the first save of a new entry.
Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: