Hi all. Perhaps I’m a bit dense and this solution is obvious, but I could use a little help getting there.
I’m looking for a way to use the date picker to select a start and end dates of an event. If it’s in the same month, I would like it to output only the date, not the month. If it’s in a different month, I’d like to output both.
February 10 – 21, 2018
March 27 – April 3, 2018
Any suggestions?
Hi @dotwongdotcom
Do you have 2 fields set up? One for start and one for end date(s)?
Phil
Hi! I had planned on two, yeah. Didn’t see an option for just one.
@dotwongdotcom perfect, then you just need to detect if both months are the same, or if they’re different.
You can find out how to turn a date value into a PHP Date object here: https://www.advancedcustomfields.com/resources/date-picker/
Use that to wire up your logic to figure out if the months are the same or different.
Phil