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

Function date

packages/effect/src/internal/config.ts:244–261  ·  view source on GitHub ↗
(name?: string)

Source from the content-addressed store, hash-verified

242
243/** @internal */
244export const date = (name?: string): Config.Config<Date> => {
245 const config = primitive(
246 "a date property",
247 (text) => {
248 const result = Date.parse(text)
249 if (Number.isNaN(result)) {
250 return Either.left(
251 configError.InvalidData(
252 [],
253 `Expected a Date value but received ${formatUnknown(text)}`
254 )
255 )
256 }
257 return Either.right(new Date(result))
258 }
259 )
260 return name === undefined ? config : nested(config, name)
261}
262
263/** @internal */
264export const fail = (message: string): Config.Config<never> => {

Callers

nothing calls this directly

Calls 3

primitiveFunction · 0.85
formatUnknownFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected