MCPcopy Create free account
hub / github.com/alephdata/aleph / reformatDateString

Function reformatDateString

ui/src/components/Timeline/util.ts:428–445  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

426 * already is in a supported format.
427 */
428export function reformatDateString(value: string) {
429 const yearMonth = /^(\d{4})(\d{1,2})$/;
430 const yearMonthDay = /^(\d{4})-?(\d{2})-?(\d{1,2})$/;
431
432 let match = value.match(yearMonth);
433
434 if (match) {
435 return `${match[1]}-${match[2]}`;
436 }
437
438 match = value.match(yearMonthDay);
439
440 if (match) {
441 return `${match[1]}-${match[2]}-${match[3]}`;
442 }
443
444 return value;
445}

Callers 2

TemporalExtentFieldsFunction · 0.90
util.test.tsFile · 0.90

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected