Skip to content

Commit 8f8c47c

Browse files
duncanmccleanclaude
andcommitted
Remove duplicated presets from DateFormatter instance field
The instance #presets field was duplicating the static presets getter. Now #normalizeOptions references DateFormatter.presets directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b64f90a commit 8f8c47c

1 file changed

Lines changed: 2 additions & 19 deletions

File tree

resources/js/components/DateFormatter.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,6 @@ import { getLocale, getDefaultLocale, setDefaultLocale } from './FormattingLocal
33
export default class DateFormatter {
44
#date;
55
#options;
6-
#presets = {
7-
datetime: {
8-
year: 'numeric',
9-
month: 'numeric',
10-
day: 'numeric',
11-
hour: 'numeric',
12-
minute: 'numeric',
13-
},
14-
date: {
15-
year: 'numeric',
16-
month: 'numeric',
17-
day: 'numeric',
18-
},
19-
time: {
20-
timeStyle: 'short',
21-
},
22-
};
236

247
constructor(date, options) {
258
this.#date = this.#normalizeDate(date);
@@ -151,9 +134,9 @@ export default class DateFormatter {
151134
if (!options) options = 'datetime';
152135

153136
if (typeof options === 'string') {
154-
if (!this.#presets[options]) throw new Error(`Invalid date format: ${options}`);
137+
if (!DateFormatter.presets[options]) throw new Error(`Invalid date format: ${options}`);
155138

156-
return this.#presets[options];
139+
return DateFormatter.presets[options];
157140
}
158141

159142
return options;

0 commit comments

Comments
 (0)