Skip to content

Commit dfcb525

Browse files
committed
Model Morocco as Sundown
1 parent 941db30 commit dfcb525

File tree

6 files changed

+49
-19
lines changed

6 files changed

+49
-19
lines changed

components/datetime/tests/patterns/tests/time_zones.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,28 @@
4242
"vvvv": "heure d’Europe centrale (Algérie)"
4343
}
4444
},
45+
{
46+
"locale": "en-GB",
47+
"datetime": "2021-07-11T12:00:00.000+01[Africa/Casablanca]",
48+
"expectations": {
49+
"z": "CET",
50+
"zzzz": "Central European Standard Time",
51+
52+
"v": "Morocco Time",
53+
"vvvv": "Morocco Time"
54+
}
55+
},
56+
{
57+
"locale": "en-GB",
58+
"datetime": "2021-07-11T12:00:00.000+00[Africa/Casablanca]",
59+
"expectations": {
60+
"z": "GMT+0",
61+
"zzzz": "GMT+00:00",
62+
63+
"v": "Morocco Time",
64+
"vvvv": "Morocco Time"
65+
}
66+
},
4567
{
4668
"locale": "en",
4769
"datetime": "2021-07-11T12:00:00.000-06:00[America/Regina]",

provider/data/time/data/timezone_periods_v1.rs.data

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/time/fingerprints.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
timezone/identifiers/iana/core/v1, <singleton>, 9559B, 9516B, fe8602f4657f987
22
timezone/identifiers/iana/extended/v1, <singleton>, 9757B, 9735B, ca82fcaee49bef7
33
timezone/identifiers/windows/v1, <singleton>, 8634B, 8591B, 90b7fe3f9cadf5bd
4-
timezone/periods/v1, <singleton>, 7173B, 7086B, 945f137c71bb7cf7
4+
timezone/periods/v1, <singleton>, 7165B, 7078B, 43627fd5d449efa7

provider/data/time/stubdata/timezone_periods_v1.rs.data

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/source/data/debug/timezone/periods/v1.json

Lines changed: 4 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/source/src/time_zones/mod.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,11 @@ impl SourceDataProvider {
9595
(("iedub", "GMT", ZoneNameTimestamp::far_in_past()), (0, None)),
9696
(("iedub", "IST", ZoneNameTimestamp::far_in_past()), (0, Some(3600))),
9797
// Morroco and Western Sahara used to observe +0 with normal summer DST, but currently they observe +1 with
98-
// negative DST during Ramadan. Model this all as normal DST.
99-
// TODO: Here we could set the zone variant to Ramadan
98+
// negative DST during Ramadan.
99+
(("macas", "+00", ZoneNameTimestamp::from_zoned_date_time_iso(ZonedDateTime::try_offset_only_from_str("2018-10-28T02:00:00Z", Iso).unwrap())), (3600, Some(0))),
100+
(("macas", "+01", ZoneNameTimestamp::from_zoned_date_time_iso(ZonedDateTime::try_offset_only_from_str("2018-10-28T02:00:00Z", Iso).unwrap())), (3600, None)),
101+
(("eheai", "+00", ZoneNameTimestamp::from_zoned_date_time_iso(ZonedDateTime::try_offset_only_from_str("2018-10-28T02:00:00Z", Iso).unwrap())), (3600, Some(0))),
102+
(("eheai", "+01", ZoneNameTimestamp::from_zoned_date_time_iso(ZonedDateTime::try_offset_only_from_str("2018-10-28T02:00:00Z", Iso).unwrap())), (3600, None)),
100103
(("macas", "+00", ZoneNameTimestamp::far_in_past()), (0, None)),
101104
(("macas", "+01", ZoneNameTimestamp::far_in_past()), (0, Some(3600))),
102105
(("eheai", "+00", ZoneNameTimestamp::far_in_past()), (0, None)),
@@ -170,6 +173,19 @@ impl SourceDataProvider {
170173
.flatten()
171174
.collect::<Vec<_>>();
172175

176+
if iana == "Africa/Casablanca" {
177+
periods = vec![
178+
(ZoneNameTimestamp::far_in_past(), Some("Europe_Western")),
179+
(ZoneNameTimestamp::from_zoned_date_time_iso(ZonedDateTime::try_offset_only_from_str("2018-10-28T02:00:00Z", Iso).unwrap()), Some("Europe_Central")),
180+
];
181+
} else if iana == "Africa/El_Aaiun" {
182+
periods = vec![
183+
(ZoneNameTimestamp::far_in_past(), None),
184+
(ZoneNameTimestamp::from_zoned_date_time_iso(ZonedDateTime::try_offset_only_from_str("1976-04-14T00:00:00-01", Iso).unwrap()), Some("Europe_Western")),
185+
(ZoneNameTimestamp::from_zoned_date_time_iso(ZonedDateTime::try_offset_only_from_str("2018-10-28T02:00:00Z", Iso).unwrap()), Some("Europe_Central")),
186+
];
187+
}
188+
173189
let mut i = 0;
174190
while i < periods.len() {
175191
if i + 1 < periods.len() && periods[i].0 == periods[i + 1].0 {

0 commit comments

Comments
 (0)