MCPcopy
hub / github.com/vuetifyjs/vuetify / date

Function date

packages/vuetify/src/composables/date/adapters/vuetify.ts:129–147  ·  view source on GitHub ↗
(value?: any)

Source from the content-addressed store, hash-verified

127const _YYYMMDD = /^([12]\d{3}-([1-9]|0[1-9]|1[0-2])-([1-9]|0[1-9]|[12]\d|3[01]))$/
128
129function date (value?: any): Date | null {
130 if (value == null) return new Date()
131
132 if (value instanceof Date) return value
133
134 if (typeof value === 'string') {
135 let parsed
136
137 if (_YYYMMDD.test(value)) {
138 return parseLocalDate(value)
139 } else {
140 parsed = Date.parse(value)
141 }
142
143 if (!isNaN(parsed)) return new Date(parsed)
144 }
145
146 return null
147}
148
149const sundayJanuarySecond2000 = new Date(2000, 0, 2)
150

Callers 2

formatFunction · 0.85
dateMethod · 0.85

Calls 2

parseLocalDateFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…