MCPcopy Create free account
hub / github.com/effect-app/libs / CauseReason

Function CauseReason

repos/effect/packages/effect/src/Schema.ts:9091–9158  ·  view source on GitHub ↗
(error: E, defect: D)

Source from the content-addressed store, hash-verified

9089/**
9090 * Schema that decodes a string into a JavaScript `Date`.
9091 *
9092 * **When to use**
9093 *
9094 * Use to model string-encoded dates that decode to JavaScript `Date` objects
9095 * and encode back to strings.
9096 *
9097 * **Details**
9098 *
9099 * Decoding:
9100 * The string is passed to JavaScript `Date` construction.
9101 *
9102 * Encoding:
9103 * A `Date` is encoded as an ISO string.
9104 *
9105 * Invalid date strings fail decoding.
9106 *
9107 * @see {@link DateFromMillis} for decoding epoch milliseconds into Date instances
9108 * @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values
9109 * @see {@link Date} for accepting Date instances directly
9110 *
9111 * @category schemas
9112 * @since 3.10.0
9113 */
9114export const DateFromString: DateFromString = DateString.pipe(decodeTo(Date, SchemaTransformation.dateFromString))
9115/**
9116 * Type-level representation of {@link DateFromMillis}.
9117 *
9118 * @category models
9119 * @since 4.0.0
9120 */
9121export interface DateFromMillis extends decodeTo<Date, Int> {
9122 readonly "Rebuild": DateFromMillis
9123}
9124/**
9125 * Schema that decodes epoch milliseconds into a JavaScript `Date`.
9126 *
9127 * **When to use**
9128 *
9129 * Use to model numeric millisecond timestamps that decode to JavaScript `Date`
9130 * objects and encode back to numbers.
9131 *
9132 * **Details**
9133 *
9134 * Decoding:
9135 * A safe integer number of milliseconds since the Unix epoch is decoded as a
9136 * `Date`.
9137 *
9138 * Encoding:
9139 * A `Date` is encoded as its millisecond timestamp.
9140 *
9141 * **Gotchas**
9142 *
9143 * JavaScript `Date` supports a narrower range than safe integers, so integers
9144 * outside the supported `Date` range fail decoding.
9145 *
9146 * @see {@link DateFromString} for decoding string-encoded dates
9147 * @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
9148 *

Callers 1

CauseFunction · 0.70

Calls 14

UndefinedOrInterface · 0.85
causeReasonToArbitraryFunction · 0.85
causeReasonToEquivalenceFunction · 0.85
causeReasonToFormatterFunction · 0.85
someMethod · 0.80
declareConstructorFunction · 0.70
linkFunction · 0.70
UnionFunction · 0.70
StructFunction · 0.70
LiteralFunction · 0.70
makeFunction · 0.70
transformMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…