Skip to content
This repository was archived by the owner on Feb 1, 2019. It is now read-only.

Term description of date fields have timezone #67

Merged
merged 3 commits into from
Jun 30, 2015

Conversation

kurtrwall
Copy link

When a single datetime/time is saved, it is saved in a taxonomy as a term. In this term, the description is empty. This uses the empty description to save the timezone of the field. This is useful for the event ics file generation. Without it, the event start/end times are set in the UTC timezone.

Test

Save an unrepeated time or datetime field and look at the api output. If the term has a description that matches the timezone selected for the field, then mission accomplished.

@jimmynotjim @Scotchester

@Scotchester
Copy link
Contributor

Isn't there a way to store the timezone as part of the datetime or time field itself?

@kurtrwall
Copy link
Author

There is, but there are a couple problems with it. For instance, when a date is saved, the information is in a tag below the input fields. When saving the post again there isn't any of the data in the $_POST dictionary is it gets wiped out each time. And on top of that, if we just put the data back in the input fields, the post would resave data that we already saved or, more importantly, if it were a field that allowed multiple dates then we couldn't know which date data to put back into the input fields.

@kurtrwall
Copy link
Author

The real solution is to move the date fields away from saving into a taxonomy. That's a bigger effort.

@Scotchester
Copy link
Contributor

How is the timezone set on the front end?

@kurtrwall
Copy link
Author

In each of the time/datetime fields, there is an input for timezone that must be set for each field.

@Scotchester
Copy link
Contributor

Which already existed? It just wasn't being stored in this manner, before?

@kurtrwall
Copy link
Author

It was added when datetime and time fields were created.

@kurtrwall
Copy link
Author

@dpford @Scotchester @jimmynotjim this should get in before we start really putting content into Wordpress for events, as the event ics file relies on this to work correctly.

@jimmynotjim
Copy link

Tested locally and working. Thanks for making the formatting the same across timestamps. 👍

@Scotchester
Copy link
Contributor

@jimmynotjim Did you run the tests? That was the only thing I wanted to do before diving a thumbs up.

@dpford
Copy link
Contributor

dpford commented Jun 29, 2015

+1 for working locally, have to install phpunit to run tests

@jimmynotjim
Copy link

yep, just ran the tests with Kurt's help getting phpunit working.

@jimmynotjim
Copy link

and kurt is the bomb

(downside to screenhero is kurt patting himself on the shoulder)

@kurtrwall
Copy link
Author

Merging since it has enough thumbs. Up that is.

kurtrwall pushed a commit that referenced this pull request Jun 30, 2015
Term description of date fields have timezone
@kurtrwall kurtrwall merged commit 932c8f0 into cfpb:master Jun 30, 2015
@kurtrwall kurtrwall deleted the tax-timezone branch June 30, 2015 19:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants