Skip to content

Commit 1a3a3a1

Browse files
committed
Show timezone info only once per date label
1 parent 24ac89e commit 1a3a3a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/model/input-types/date-specification.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ export module DateSpecification {
1717
export function generateLabel(date: DateSpecification, timezone: string, timeSuffix: string,
1818
locale: string): string {
1919

20-
let result: string = getValueLabel(date.value, timezone, timeSuffix, locale);
21-
if (date.endValue) result += ' - ' + getValueLabel(date.endValue, timezone, timeSuffix, locale);
20+
let result: string = getValueLabel(date.value, timezone, timeSuffix, locale, !date.endValue);
21+
if (date.endValue) result += ' - ' + getValueLabel(date.endValue, timezone, timeSuffix, locale, true);
2222

2323
return result;
2424
}
2525

2626

27-
function getValueLabel(value: string, timezone: string, timeSuffix: string, locale: string): string {
27+
function getValueLabel(value: string, timezone: string, timeSuffix: string, locale: string, addTimezoneInfo: boolean): string {
2828

2929
const hasTimeValue: boolean = value.includes(':');
3030
const date: Date = parseDate(value);
@@ -33,7 +33,7 @@ export module DateSpecification {
3333
// If the time suffix is set to '.', this indicates that no time suffix should be used
3434
if (hasTimeValue && timeSuffix !== '.') formattedDate = formattedDate + ' ' + timeSuffix;
3535

36-
if (hasTimeValue) formattedDate += ' (' + timezone + ')';
36+
if (addTimezoneInfo && hasTimeValue) formattedDate += ' (' + timezone + ')';
3737

3838
return formattedDate;
3939
}

0 commit comments

Comments
 (0)