studioespresso / craft-date-range

Date range field for Craft CMS
MIT License
12 stars 6 forks source link

Data disappears #4

Closed martinsmith closed 4 years ago

martinsmith commented 4 years ago

Hello, i'm using the field inside SuperTable, whenever I save the entry the values I added are removed from the Date Range field? When I go back in the field is blank again?

janhenckens commented 4 years ago

Hey Martin, that's not supposed to happen. I'll test it in a supertable field as well and see if I can reproduce (and fix) it.

martinsmith commented 4 years ago

Thank you :)

martinsmith commented 4 years ago

I don't know if this helps?

image

janhenckens commented 4 years ago

It does, thanks!

martinsmith commented 4 years ago

Hi, I noticed you published an update so I updated. Indeed the fields now retain their data BUT if one field is left blank then all fields are stripped as before. Scenario: A single workshop runs on a single night so there is no need for the 'end date', but it does have an 'end time'. If I leave 'End Date' blank all fields are emptied on save.

janhenckens commented 4 years ago

Yes, that is something that I'm looking at. For the other plugins functions (future, past, ongoing) to work, I need both dates.

My current idea is that if the end date is left empty, I'll just use the start value and add it there as well. Would that work for you?

martinsmith commented 4 years ago

That could work. Would that work with conditionals? {% if fieldName.end %} Show end date {% endif %}

janhenckens commented 4 years ago

Yep, you can do things like {% if fieldName.start|date('d/m/Y') == fieldName.end|date('d/m/Y') %} etc...

I'll try to add this tonight or tomorrow :)

martinsmith commented 4 years ago

Thank you!

janhenckens commented 4 years ago

Hey Martin, sorry for the slight delay, this just got released!