Skip to content

Commit cf7fae0

Browse files
committed
For en-US locale when extracting timezone info
Followup to #21585
1 parent 86b6aff commit cf7fae0

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/library.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ addToLibrary({
649649

650650
{{{ makeSetValue('daylight', '0', 'Number(winterOffset != summerOffset)', 'i32') }}};
651651

652-
var extractZone = (date) => date.toLocaleTimeString(undefined, {timeZoneName:'short'}).split(' ')[2];
652+
var extractZone = (date) => date.toLocaleTimeString('en-US', {timeZoneName:'short'}).split(' ')[2];
653653
var winterName = extractZone(winter);
654654
var summerName = extractZone(summer);
655655
#if ASSERTIONS

test/common.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,25 @@ def modified(self, *args, **kwargs):
365365
return decorated
366366

367367

368+
# Decorator version of env_modify
369+
def also_with_env_modify(name, updates):
370+
371+
def decorated(f):
372+
@wraps(f)
373+
def metafunc(self, modified, *args, **kwargs):
374+
if modified:
375+
with env_modify(updates):
376+
return f(self, *args, **kwargs)
377+
else:
378+
return f(self, *args, **kwargs)
379+
380+
metafunc._parameterize = {'': (False,),
381+
name: (True,)}
382+
return metafunc
383+
384+
return decorated
385+
386+
368387
def also_with_minimal_runtime(f):
369388
assert callable(f)
370389

test/test_other.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from common import env_modify, no_mac, no_windows, only_windows, requires_native_clang, with_env_modify
3535
from common import create_file, parameterized, NON_ZERO, node_pthreads, TEST_ROOT, test_file
3636
from common import compiler_for, EMBUILDER, requires_v8, requires_node, requires_wasm64, requires_node_canary
37-
from common import requires_wasm_eh, crossplatform, with_both_eh_sjlj, with_both_sjlj, also_with_standalone_wasm
37+
from common import requires_wasm_eh, crossplatform, with_both_eh_sjlj, with_both_sjlj
38+
from common import also_with_standalone_wasm, also_with_env_modify
3839
from common import also_with_minimal_runtime, also_with_wasm_bigint, also_with_wasm64, flaky
3940
from common import EMTEST_BUILD_VERBOSE, PYTHON, WEBIDL_BINDER
4041
from common import requires_network
@@ -5717,6 +5718,8 @@ def test_only_force_stdlibs_2(self):
57175718
self.run_process([EMXX, 'src.cpp', '-sDISABLE_EXCEPTION_CATCHING=0'])
57185719
self.assertContained('Caught exception: std::exception', self.run_js('a.out.js'))
57195720

5721+
@crossplatform
5722+
@also_with_env_modify('gb_locale', {'LC_ALL': 'en_GB'})
57205723
def test_strftime_zZ(self):
57215724
create_file('src.c', r'''
57225725
#include <errno.h>

0 commit comments

Comments
 (0)