Reviewers: eisinger, mnita_google.com,

Message:
First commit to v8-i18n after it got moved to the v8 proper.

Description:
Fixing a timezone name issue with i18n date time formatter.

BUG=https://code.google.com/p/v8-i18n/issues/detail?id=32

Please review this at https://codereview.chromium.org/25582002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+21, -25 lines):
  M src/i18n.js
  A + test/intl/date-format/timezone-name.js


Index: src/i18n.js
diff --git a/src/i18n.js b/src/i18n.js
index a80fd4d9b4a528d21e21902891fdfa7245e5583a..aac440ea597686a93ccee8a4cb5be73069c53cab 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -1367,7 +1367,7 @@ function toLDMLString(options) {
ldmlString += appendToLDMLString(option, {'2-digit': 'ss', 'numeric': 's'});

   option = getOption('timeZoneName', 'string', ['short', 'long']);
-  ldmlString += appendToLDMLString(option, {short: 'v', long: 'vv'});
+  ldmlString += appendToLDMLString(option, {short: 'z', long: 'zzzz'});

   return ldmlString;
 }
@@ -1440,9 +1440,9 @@ function fromLDMLString(ldmlString) {
   options = appendToDateTimeObject(
       options, 'second', match, {s: 'numeric', ss: '2-digit'});

-  match = ldmlString.match(/v{1,2}/g);
+  match = ldmlString.match(/z|zzzz/g);
   options = appendToDateTimeObject(
-      options, 'timeZoneName', match, {v: 'short', vv: 'long'});
+      options, 'timeZoneName', match, {z: 'short', zzzz: 'long'});

   return options;
 }
Index: test/intl/date-format/timezone-name.js
diff --git a/src/hydrogen-dce.h b/test/intl/date-format/timezone-name.js
similarity index 68%
copy from src/hydrogen-dce.h
copy to test/intl/date-format/timezone-name.js
index 19749f279a2e1cb632ba5a300033e5a9f038638f..9757d2645abf2d0ffdb0d5655a6e6bc1994534e3 100644
--- a/src/hydrogen-dce.h
+++ b/test/intl/date-format/timezone-name.js
@@ -25,32 +25,28 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-#ifndef V8_HYDROGEN_DCE_H_
-#define V8_HYDROGEN_DCE_H_
+// Tests time zone names.

-#include "hydrogen.h"
+// Winter date (PST).
+var winter = new Date(2013, 1, 12, 14, 42, 53, 0);

-namespace v8 {
-namespace internal {
+// Summer date (PDT).
+var summer = new Date(2013, 7, 12, 14, 42, 53, 0);

-
-class HDeadCodeEliminationPhase : public HPhase {
- public:
-  explicit HDeadCodeEliminationPhase(HGraph* graph)
-      : HPhase("H_Dead code elimination", graph) { }
-
-  void Run() {
-    MarkLiveInstructions();
-    RemoveDeadInstructions();
-  }
-
- private:
-  bool MarkLive(HValue* ref, HValue* instr);
-  void MarkLiveInstructions();
-  void RemoveDeadInstructions();
+// Common flags for both formatters.
+var flags = {
+  year: 'numeric', month: 'long', day: 'numeric',
+  hour : "2-digit", minute : "2-digit", second : "2-digit"
 };

+flags.timeZoneName = "short";
+var dfs = new Intl.DateTimeFormat('en-US', flags);
+
+assertTrue(dfs.format(winter).indexOf('PST') !== -1);
+assertTrue(dfs.format(summer).indexOf('PDT') !== -1);

-} }  // namespace v8::internal
+flags.timeZoneName = "long";
+var dfl = new Intl.DateTimeFormat('en-US', flags);

-#endif  // V8_HYDROGEN_DCE_H_
+assertTrue(dfl.format(winter).indexOf('Pacific Standard Time') !== -1);
+assertTrue(dfl.format(summer).indexOf('Pacific Daylight Time') !== -1);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to