Skip to content

Commit c0c0d3c

Browse files
duncanmccleanclaude
andcommitted
Use configured timezone in replicator preview
The replicator preview was always using browser-local timezone formatting. Now it respects the field's configured timezone via the displayTimezone computed property. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 771e28c commit c0c0d3c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

resources/js/components/fieldtypes/DateFieldtype.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,24 @@ export default {
9292
return this.hasTime ? (this.hasSeconds ? 'second' : 'minute') : 'day';
9393
},
9494
95+
replicatorPreviewOptions() {
96+
const preset = this.hasTime ? 'datetime' : 'date';
97+
const tz = this.displayTimezone;
98+
99+
return { ...DateFormatter.presets[preset], timeZone: tz };
100+
},
101+
95102
replicatorPreview() {
96103
if (!this.showFieldPreviews) return;
97104
if (!this.value) return;
98105
106+
const formatter = new DateFormatter().options(this.replicatorPreviewOptions);
107+
99108
if (this.isRange) {
100-
const formatter = new DateFormatter().options(this.hasTime ? 'datetime' : 'date');
101109
return formatter.date(this.value.start) + '' + formatter.date(this.value.end);
102110
}
103111
104-
return DateFormatter.format(this.value, this.hasTime && this.value ? 'datetime' : 'date');
112+
return formatter.date(this.value).toString();
105113
},
106114
},
107115

0 commit comments

Comments
 (0)