MCPcopy Create free account
hub / github.com/Effect-TS/effect / formatDate

Function formatDate

packages/sql/pg/src/PgTypes.ts:587–595  ·  view source on GitHub ↗
(days: number)

Source from the content-addressed store, hash-verified

585}
586
587const formatDate = (days: number): string => {
588 const { day, month, year } = civilFromDays(days)
589 const yearText = year < 0
590 ? `-${pad(-year, 4)}`
591 : year < 10000
592 ? twoDigits[(year / 100) | 0] + twoDigits[year % 100]
593 : String(year)
594 return `${yearText}-${twoDigits[month]}-${twoDigits[day]}`
595}
596
597const timeRegex = /^(\d{1,2}):(\d{2})(?::(\d{2})(?:\.(\d{1,6}))?)?$/
598

Callers 1

PgTypes.tsFile · 0.70

Calls 3

civilFromDaysFunction · 0.85
padFunction · 0.70
StringFunction · 0.50

Tested by

no test coverage detected