FIX: prefer timezones over timezone for previews (#10506)

eg:

timezone="America/Detroit"
timezones="US/Eastern"

Before this commit we would show America/Detroit in previews and not US/Eastern, given US/Eastern and America/Detroit are equivalent.

After this commit, we will display the date with America/Detroit but show US/Eastern in the previews.
This commit is contained in:
Joffrey JAFFEUX 2020-08-21 16:31:50 +02:00 committed by GitHub
parent 1acb2f752b
commit 4f7a9802e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -83,9 +83,7 @@ export default class LocalDateBuilder {
const previewedTimezones = [];
const timezones = this.timezones.filter(
timezone =>
!this._isEqualZones(timezone, this.localTimezone) &&
!this._isEqualZones(timezone, this.timezone)
timezone => !this._isEqualZones(timezone, this.localTimezone)
);
previewedTimezones.push({
@ -105,7 +103,8 @@ export default class LocalDateBuilder {
this.timezone &&
displayedTimezone === this.localTimezone &&
this.timezone !== displayedTimezone &&
!this._isEqualZones(displayedTimezone, this.timezone)
!this._isEqualZones(displayedTimezone, this.timezone) &&
!this.timezones.any(t => this._isEqualZones(t, this.timezone))
) {
timezones.unshift(this.timezone);
}