forked from Eleven-Trading/TradeNote
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch-timezones.py
More file actions
60 lines (53 loc) · 1.24 KB
/
Copy pathpatch-timezones.py
File metadata and controls
60 lines (53 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from pathlib import Path
import re
file_path = Path("src/stores/globals.js")
main_timezones = [
"America/New_York",
"America/Los_Angeles",
"America/Chicago",
"America/Denver",
"America/Phoenix",
"America/Anchorage",
"Pacific/Honolulu",
"America/Toronto",
"America/Vancouver",
"America/Mexico_City",
"America/Sao_Paulo",
"UTC",
"Europe/London",
"Europe/Dublin",
"Europe/Brussels",
"Europe/Paris",
"Europe/Berlin",
"Europe/Madrid",
"Europe/Rome",
"Europe/Amsterdam",
"Europe/Zurich",
"Europe/Stockholm",
"Europe/Warsaw",
"Europe/Moscow",
"Asia/Riyadh",
"Asia/Dubai",
"Asia/Kolkata",
"Asia/Bangkok",
"Asia/Singapore",
"Asia/Shanghai",
"Asia/Hong_Kong",
"Asia/Tokyo",
"Asia/Seoul",
"Australia/Sydney",
"Australia/Melbourne",
"Pacific/Auckland",
]
s = file_path.read_text()
new_line = 'export const timeZones = ref(' + repr(main_timezones).replace("'", '"') + ')'
s2, n = re.subn(
r'export const timeZones = ref\(\[[^\]]*\]\)',
new_line,
s,
count=1,
)
if n != 1:
raise SystemExit("Could not find timeZones array in src/stores/globals.js")
file_path.write_text(s2)
print("Updated timeZones in", file_path)