datetime - Does Magento expect server timezone to match default store timezone? -


take @ mage_core_model_date::gmttimestamp() :

/**  * forms gmt timestamp  *  * @param  int|string $input date in current timezone  * @return int  */ public function gmttimestamp($input = null) {     if (is_null($input)) {         return gmdate('u');     } else if (is_numeric($input)) {         $result = $input;     } else {         $result = strtotime($input);     }      if ($result === false) {         // strtotime() unable parse string (it's not date or has incorrect format)         return false;     }      $date      = mage::app()->getlocale()->date($result);     $timestamp = $date->get(zend_date::timestamp) - $date->get(zend_date::timezone_secs);      unset($date);     return $timestamp;  } 

assume $input "today".
assume server timezone utc.

$date->get(zend_date::timezone_secs) corresponds difference in seconds between store timezone , utc. if magento default store (i'm testing admin) timezone iz pacific/auckland (gmt+12), value 43200 .

now, given magento subtracting difference timestamp obtained through strtotime, expecting obtained timestamp matches store timezone. however, not, , subtracting nz time difference gmt time, result gmt-12, instead of gmt+00

this behaviour in particular affects applying catalog rules. if take @ catalogrule_product_price, see rule entries created current day, previous day , next day. however, due gmt-12 bug described above, in occassions, entries made current day, yesterday, , day before yesterday.

this creates problems on frontend in following way: in mage_catalogrule_model_observer::processfrontfinalprice() , $date value match nz timestamp. , gmt+12, or in cases, 1 day in future position of utc observer. since entries in catalogrule_product_price not contain entry next day, result in failure obtain catalog rule.

you can trigger execution of code applying catalog rule in admin.

after significant testing, in short, yes, base store time zone should match server time zone.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -