Skip to content
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

Date field is not saving #3538

Closed
JayGeorge opened this issue Apr 16, 2021 · 5 comments
Closed

Date field is not saving #3538

JayGeorge opened this issue Apr 16, 2021 · 5 comments

Comments

@JayGeorge
Copy link

Bug Description

When you add a date field to a blueprint, then try to save it in an entry, it won't save to the md content file.

How to Reproduce

Screencast attached.

  1. Add a date field to a blueprint
  2. Back in the entry, pick a date, hit save
  3. Refresh the page, and note how the date is still blank. Check the markdown file and observe how the date ha not been saved to the md content file.

Extra Detail

Screencast here
https://user-images.githubusercontent.com/693601/115014546-63261080-9eaa-11eb-9ee5-30857f0d74e7.mp4

Environment

Statamic 3.1.7 Solo
Laravel 8.37.0
PHP 7.4.13
No addons installed

Install method (choose one):

  • Fresh install from statamic/statamic
@JayGeorge
Copy link
Author

Someone suggested to me on Discord that this is because date is a reserved variable.
Sure enough, changing the variable to something like photo_date fixed the problem.
I think it's a UI issue that it defaults to a reserved variable when adding the new field though. Maybe that should be changed?

@jasonvarga
Copy link
Member

If you're planning to use dates, why not make it a dated collection? Then you get them without having to do anything extra.

@duncanmcclean
Copy link
Member

I'm unable to reproduce this issue. Could you share the date field you're using? Maybe it's configured differently to mine.

@JayGeorge
Copy link
Author

If you're planning to use dates, why not make it a dated collection? Then you get them without having to do anything extra.

You mean Enable Publish Dates? I mean, I guess I could do that, but in my particular case, I'm adding a date for when a photo was taken, which could be like 1956 or something, so it's not a published date.
Changing the variable to photo_date worked fine, but I think it would be helpful if there were a kind of warning when using the default date variable, or maybe it could default to date_1 or something to prevent the default workflow from causing an error.

I'm unable to reproduce this issue. Could you share the date field you're using? Maybe it's configured differently from mine.

From the YAML? I accepted the defaults; it's like this:

      -
        handle: date
        field:
          mode: single
          time_enabled: false
          time_required: false
          earliest_date: '1900-01-01'
          full_width: false
          inline: false
          columns: 1
          rows: 1
          display: Date
          type: date
          icon: date
          listable: hidden

@jackmcdade
Copy link
Member

Closing in favor of the more UX-centric #3956. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants