How to group time zones

Intro

Recap

Our new approach to show grouped timezones.

The “LMGTF” approach

Definition of “Similarity”

tz1 = pop(all_tz)
current_group = [tz1]
while(is_not_empty(all_tz)) {
tz2 = get_first(all_tz)
if (tz1.currentTime == tz2.currentTime) {
if (tz1.prefix == tz2.prefix) {
if (tz1.dateOfDSChange == tz2.dateOfDSChange) {
current_group.push(pop(all_tz))
continue_with_loop()
}
}
}
}

The script

Example

More specific

timezones = [....] // put list of timezones here
START_DATE = 2020-01-01
END_DATE = 2025-01-01
GROUPS = []foreach (tz in timezones) {
timezones.remove(tz)
currentGroup = [ tz ]
dateTimeArray = []
for (i between START_DATE && END_DATE) {
dateTimeArray.push(convertWithTZ(i, tz.label))
}
foreach (tz2 in timezones) {
if (tz.continent != tz2.continent) {
next();
}
dateTimeArray2 = []
for (i between START_DATE && END_DATE) {
dateTimeArray2.push(convertWithTZ(i, tz2.label))
}
if (dateTimeArray.equals(dateTimeArray2)) {
currentGroup.push(tz2)
timezones.remove(tz2)
breakLoop();
}
}
GROUPS.push(currentGroup);
}

Remarks

Last step(s)

Long story short

Discussion

Product Manager, Creator of Software, Gen-Y — 😍 to build!