How to save a custom attribute that is a type == date
Permalink 1 user found helpful
When I try to save a date/time attribute by writing:
$p is the page. $p works when I save other attributes (i.e. text) just not the date attribute.
It doesn't seem to be saving the date?
For example, I have a text box called "event_location" that saves successfully:
I also tried:
$date_key = CollectionAttributeKey::getByHandle('event_date_time'); $date_key->saveAttributeForm($p);
$p is the page. $p works when I save other attributes (i.e. text) just not the date attribute.
It doesn't seem to be saving the date?
For example, I have a text box called "event_location" that saves successfully:
$location_key = CollectionAttributeKey::getByHandle('event_location'); $location_key->saveAttributeForm($p);
I also tried:
$date_key = CollectionAttributeKey::getByHandle('event_date_time'); $date_key->setAttribute($p, $date_key);