Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

When site has no GMT offset saved, the expiry datetime causes problems #52

Closed
4 tasks
benlk opened this issue May 22, 2018 · 3 comments
Closed
4 tasks
Assignees
Labels
Milestone

Comments

@benlk
Copy link
Contributor

benlk commented May 22, 2018

When the 'gmt_offset' value is a number (which is pretty much everywhen), the DateTimeZone constructor complains that the number is not a valid timezone.

return date_add( date_create( $future, new DateTimeZone( $timezone ) ), new DateInterval( 'P7D' ) );
} else {
// return DateTime for the expiry date
return date_create( $iso_8601, new DateTimeZone( $timezone ) );

PHP Fatal Error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (-4)' in /plugins/npr-story-api/psuh_story.php:676'

@benlk benlk added the bug label May 22, 2018
benlk added a commit that referenced this issue May 23, 2018
…ction, and write a test for that that iterates over the known valid GMT offsets from WordPress's database.

This is for #52
@benlk
Copy link
Contributor Author

benlk commented May 23, 2018

Timezones are not a specific GMT offset; we need a GMT offset for this. A better approach is described in #53 that makes use of WordPress's tools for converting timezones to GMT offsets.

@benlk benlk added this to the 1.7.2 milestone Jul 2, 2018
@kaylima
Copy link

kaylima commented Sep 18, 2018

TODO: Up to 2 hours for remaining testing for #53 .

@kaylima kaylima mentioned this issue Sep 18, 2018
5 tasks
@benlk benlk closed this as completed in #53 Sep 19, 2018
@benlk benlk reopened this Sep 19, 2018
@benlk
Copy link
Contributor Author

benlk commented Sep 19, 2018

Automated tests for #53 pass.

Human-run tests for #53 should perform the following tasks:

  1. Activate the plugin
  2. Configure the plugin with test API credentials
  3. Create a new post.
    1. Does the NPR Story API meta box appear on the page?
    2. Are there no errors in the server console?
    3. Change the time zone in Dashboard > Settings > General to a new time zone. Repeat step 3 until satisfied.
  4. Push a post to the API.
  5. Pull a post from the API.

@benlk benlk closed this as completed Sep 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants