Skip to content

Commit

Permalink
Fix dates being converted to GMT
Browse files Browse the repository at this point in the history
  • Loading branch information
pjeby committed Oct 18, 2019
1 parent 87e0eab commit 3d53ff8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/PostImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ function post_modified() { return $this->_parseDate('post_modified_gmt', $this->

protected function _parseDate($gmtField, $date) {
$date = new WpDateTime($date, WpDateTimeZone::getWpTimezone());
$plain = $date->format('Y-m-d H:i:s');
$this->syncField( $gmtField, $date->setTimezone(new WpDateTimeZone('UTC'))->format('Y-m-d H:i:s') );
return $date->format('Y-m-d H:i:s'); // localtime version
return $plain; // localtime version
}

function syncField($field, $value, $is_callback=null) {
Expand Down

0 comments on commit 3d53ff8

Please sign in to comment.