Long Timezones in Zend_Date constructor ignored with custom date format #2

Closed
zfbot opened this Issue Apr 5, 2013 · 1 comment

Comments

Projects
None yet
2 participants

zfbot commented Apr 5, 2013

Jira Information

Original Issue:ZF-12390
Issue Type:Bug
Reporter:George Steel
Created:08/28/12
Assignee:Thomas Weidner
Components:Zend_Date

Description

When creating a date in a specific timezone using a custom date string and format specifier, if the timezone contains underscore or dashes, the timezone is ignored.

date_default_timezone_set('Europe/London');
$customDateString = '2/9/2012 13:11:00 America/Los_Angeles';
$customFormat = 'd/M/yyyy H:m:s zzzz';
$date = new Zend_Date($customDateString, $customFormat);
echo $date->toString(Zend_Date::RFC_850) . PHP_EOL;
// Expected Result: Sunday, 02-Sep-12 13:11:00 America/Los_Angeles
//   Actual Result: Sunday, 02-Sep-12 13:11:00 Europe/London

/**
 * Workaround
 */
$date = new Zend_Date;
$date->setTimezone('America/Los_Angeles');
$date->set($customDateString, $customFormat);
echo $date->toString(Zend_Date::RFC_850) . PHP_EOL;
// Returns: Sunday, 02-Sep-12 13:11:00 America/Los_Angeles

When creating a date using any other timezone that matches /[:alpha:]/[:alpha:]/ there is no issue.

zfbot commented Apr 5, 2013

This issue was ported from the ZF2 Jira Issue Tracker at
http://framework.zend.com/issues/browse/ZF-12390

Known GitHub users mentioned in the original message or comment:

@akrabat akrabat added a commit that referenced this issue Apr 1, 2014

@akrabat akrabat Merge pull request #315 from froschdesign/hotfix/2
Fixes #2 - Long Timezones in Zend_Date constructor ignored with custom d...
4afa824

froschdesign added this to the 1.12.6 milestone Apr 1, 2014

@xopherdeep xopherdeep pushed a commit to xopherdeep/Zend-Framework-v1 that referenced this issue Jul 3, 2014

@froschdesign froschdesign Fixes #2 - Long Timezones in Zend_Date constructor ignored with custo…
…m date format
dd81d45

@maksek maksek referenced this issue in magento/zf1 Dec 16, 2014

@vpelipenko vpelipenko Merge pull request #2 from msavich/master
Added custom fixes
956e87d

@ezimuel ezimuel pushed a commit that referenced this issue Jan 13, 2016

@erdraug erdraug Merge pull request #2 from zendframework/master
Update to 1.17
65251e9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment