Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

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

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

Comments

@zfbot
Copy link

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
Copy link
Author

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 added a commit that referenced this issue Apr 1, 2014
Fixes #2 - Long Timezones in Zend_Date constructor ignored with custom d...
@froschdesign froschdesign added this to the 1.12.6 milestone Apr 1, 2014
xopherdeep pushed a commit to xopherdeep/Zend-Framework-v1 that referenced this issue Jul 3, 2014
maksek referenced this issue in magento/zf1 Dec 16, 2014
ezimuel pushed a commit that referenced this issue Jan 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants