Skip to content

Commit

Permalink
Respect ignoreTimezone in the datepicker 'date' mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeTowers committed May 14, 2019
1 parent bcd5156 commit 7590dfd
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions modules/backend/formwidgets/DatePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,18 +117,15 @@ public function render()
*/
public function prepareVars()
{

if ($value = $this->getLoadValue()) {

$value = DateTimeHelper::makeCarbon($value, false);
if ($this->mode === 'date' ) {
if ($this->mode === 'date' && !$this->ignoreTimezone) {
$backendTimeZone = \Backend\Models\Preference::get('timezone');
$value->setTimezone($backendTimeZone);
$value->setTime(0,0,0);
$value->setTimezone(Config::get('app.timezone'));
}
$value = $value->toDateTimeString();

}

$this->vars['name'] = $this->getFieldName();
Expand Down

0 comments on commit 7590dfd

Please sign in to comment.