effect 4.0.0-beta.101 → 4.0.0-beta.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +462 -412
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +166 -101
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +729 -768
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +541 -449
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +226 -174
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +339 -267
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +122 -87
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +151 -274
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +9 -10
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +18 -24
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +132 -186
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2897 -3342
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1383 -1580
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +29 -21
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +13 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -28
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +109 -75
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +85 -59
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +153 -264
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +76 -145
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +40 -57
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +230 -307
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +46 -103
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +300 -239
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +195 -175
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +207 -452
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +16 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +10 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +202 -645
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +190 -292
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +213 -393
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +1 -4
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +361 -466
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +163 -216
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -213
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -213
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +25 -19
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +135 -218
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +290 -1636
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -803
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +1835 -1060
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2708 -1050
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +29 -52
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +537 -391
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +8 -7
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +230 -185
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +252 -209
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +74 -266
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +123 -86
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +398 -1513
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +290 -2854
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +116 -76
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +123 -88
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +101 -13
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +117 -107
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2430 -2958
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1124 -1397
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +46 -54
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +92 -127
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +97 -66
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +67 -45
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +127 -70
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +3 -2
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +4 -0
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +141 -61
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.d.ts +0 -3
- package/dist/internal/record.d.ts.map +1 -1
- package/dist/internal/record.js +10 -5
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -4
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +12 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js +745 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/fromRepresentation.d.ts +2 -0
- package/dist/internal/schema/fromRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/fromRepresentation.js +245 -0
- package/dist/internal/schema/fromRepresentation.js.map +1 -0
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js +28 -40
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/{arbitrary.d.ts → toArbitrary.d.ts} +1 -1
- package/dist/internal/schema/toArbitrary.d.ts.map +1 -0
- package/dist/internal/schema/{arbitrary.js → toArbitrary.js} +8 -9
- package/dist/internal/schema/toArbitrary.js.map +1 -0
- package/dist/internal/schema/toCodeDocument.d.ts +2 -0
- package/dist/internal/schema/toCodeDocument.d.ts.map +1 -0
- package/dist/internal/schema/toCodeDocument.js +438 -0
- package/dist/internal/schema/toCodeDocument.js.map +1 -0
- package/dist/internal/schema/toEquivalence.d.ts +2 -0
- package/dist/internal/schema/toEquivalence.d.ts.map +1 -0
- package/dist/internal/schema/{equivalence.js → toEquivalence.js} +15 -13
- package/dist/internal/schema/toEquivalence.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +508 -0
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/toRepresentation.d.ts +2 -0
- package/dist/internal/schema/toRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/toRepresentation.js +349 -0
- package/dist/internal/schema/toRepresentation.js.map +1 -0
- package/dist/internal/stackTraceLimit.js +3 -6
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +13 -9
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +54 -19
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +29 -29
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +121 -144
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +99 -121
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +22 -7
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +87 -317
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +55 -51
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +111 -68
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +123 -81
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +316 -250
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +71 -63
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +71 -62
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +765 -245
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +33 -11
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +194 -378
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +112 -38
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +53 -17
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +47 -33
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +23 -18
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +63 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +59 -42
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +35 -9
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +32 -14
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +15 -12
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.d.ts +2 -0
- package/dist/unstable/ai/internal/structured-output.d.ts.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +315 -0
- package/dist/unstable/ai/internal/structured-output.js.map +1 -0
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +105 -74
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +98 -63
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +705 -107
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +252 -47
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +292 -78
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +131 -49
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +345 -137
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +23 -14
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +3 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +11 -4
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +0 -48
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js +8 -10
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +2 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +6 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +9 -9
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +5 -4
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.js +5 -5
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +5 -5
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +16 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
- package/dist/unstable/cluster/RunnerStorage.js +1 -1
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +128 -26
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +13 -5
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +4 -2
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +2 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +7 -4
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +56 -25
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +127 -65
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +24 -12
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.d.ts +2 -0
- package/dist/unstable/cluster/internal/shardLock.d.ts.map +1 -0
- package/dist/unstable/cluster/internal/shardLock.js +4 -0
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -0
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +20 -20
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +8 -5
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +6 -8
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +58 -8
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +16 -16
- package/dist/unstable/eventlog/EventJournal.js +14 -14
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +18 -14
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogEncryption.js +2 -2
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +6 -6
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +9 -4
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +3 -3
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +54 -40
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +10 -10
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +44 -0
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +16 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +2 -2
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +32 -0
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +9 -8
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +10 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +6 -6
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +22 -20
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +26 -31
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +3 -3
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +16 -18
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +50 -37
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +70 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +84 -6
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -3
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +2 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +11 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +5 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -3
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +2 -2
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +2 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.js +6 -6
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -15
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +28 -17
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +26 -15
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +3 -3
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +4 -2
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +14 -13
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +105 -19
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +44 -12
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +25 -4
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +12 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +14 -12
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +175 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +52 -50
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +6 -7
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +15 -12
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +12 -4
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +10 -5
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +2 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +2 -2
- package/dist/unstable/sql/SqlError.js +2 -2
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +22 -21
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +6 -6
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +5 -6
- package/src/Array.ts +1068 -1070
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +409 -255
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +923 -830
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +618 -334
- package/src/ConfigProvider.ts +221 -127
- package/src/Console.ts +289 -39
- package/src/Context.ts +319 -378
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +13 -15
- package/src/Data.ts +63 -82
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +216 -308
- package/src/Effect.ts +2958 -3390
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +49 -39
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +13 -55
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +155 -107
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +124 -82
- package/src/FileSystem.ts +155 -263
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +76 -145
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +622 -787
- package/src/JsonPatch.ts +60 -113
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +405 -249
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +359 -260
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +347 -699
- package/src/ManagedRuntime.ts +20 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +520 -1092
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +246 -385
- package/src/Option.ts +449 -813
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/PartitionedSemaphore.ts +1 -4
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +387 -487
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -214
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +36 -28
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +314 -485
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +308 -1734
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +3156 -1634
- package/src/SchemaAST.ts +676 -489
- package/src/SchemaError.ts +8 -7
- package/src/SchemaGetter.ts +277 -218
- package/src/SchemaIssue.ts +90 -276
- package/src/SchemaParser.ts +179 -116
- package/src/SchemaRepresentation.ts +698 -3417
- package/src/SchemaTransformation.ts +132 -91
- package/src/Scope.ts +123 -151
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +157 -54
- package/src/Sink.ts +128 -113
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2665 -3142
- package/src/String.ts +275 -312
- package/src/Struct.ts +114 -118
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/Terminal.ts +2 -2
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +92 -127
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +97 -66
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +127 -70
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/index.ts +0 -5
- package/src/internal/core.ts +5 -4
- package/src/internal/dateTime.ts +6 -0
- package/src/internal/effect.ts +160 -79
- package/src/internal/matcher.ts +1 -1
- package/src/internal/persistence.ts +2 -0
- package/src/internal/record.ts +11 -7
- package/src/internal/references.ts +3 -7
- package/src/internal/schema/annotations.ts +44 -0
- package/src/internal/schema/fromJsonSchemaDocument.ts +959 -0
- package/src/internal/schema/fromRepresentation.ts +339 -0
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/schema.ts +45 -46
- package/src/internal/schema/{arbitrary.ts → toArbitrary.ts} +8 -10
- package/src/internal/schema/toCodeDocument.ts +572 -0
- package/src/internal/schema/{equivalence.ts → toEquivalence.ts} +12 -7
- package/src/internal/schema/toJsonSchemaDocument.ts +529 -0
- package/src/internal/schema/toRepresentation.ts +386 -0
- package/src/internal/stackTraceLimit.ts +3 -7
- package/src/internal/trie.ts +10 -11
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +73 -31
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +29 -29
- package/src/unstable/ai/AiError.ts +100 -122
- package/src/unstable/ai/AnthropicStructuredOutput.ts +103 -334
- package/src/unstable/ai/Chat.ts +132 -97
- package/src/unstable/ai/EmbeddingModel.ts +1 -1
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +137 -95
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +75 -65
- package/src/unstable/ai/McpServer.ts +1045 -303
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +231 -396
- package/src/unstable/ai/Prompt.ts +145 -43
- package/src/unstable/ai/Response.ts +52 -38
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +81 -48
- package/src/unstable/ai/Toolkit.ts +45 -15
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/codec-transformer.ts +13 -7
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +453 -0
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +116 -77
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +709 -111
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +295 -81
- package/src/unstable/cli/Primitive.ts +371 -150
- package/src/unstable/cli/Prompt.ts +28 -14
- package/src/unstable/cli/internal/command.ts +13 -5
- package/src/unstable/cli/internal/config.ts +8 -10
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +8 -4
- package/src/unstable/cluster/Entity.ts +16 -17
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +5 -4
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +15 -15
- package/src/unstable/cluster/Reply.ts +5 -7
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +41 -8
- package/src/unstable/cluster/RunnerStorage.ts +2 -2
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/ShardId.ts +1 -1
- package/src/unstable/cluster/Sharding.ts +168 -42
- package/src/unstable/cluster/ShardingConfig.ts +8 -4
- package/src/unstable/cluster/SingleRunner.ts +4 -2
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +84 -36
- package/src/unstable/cluster/SqlRunnerStorage.ts +205 -119
- package/src/unstable/cluster/internal/entityManager.ts +42 -25
- package/src/unstable/cluster/internal/shardLock.ts +9 -0
- package/src/unstable/devtools/DevToolsSchema.ts +10 -5
- package/src/unstable/encoding/Msgpack.ts +6 -8
- package/src/unstable/encoding/Sse.ts +98 -16
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +16 -16
- package/src/unstable/eventlog/EventLog.ts +24 -14
- package/src/unstable/eventlog/EventLogEncryption.ts +2 -2
- package/src/unstable/eventlog/EventLogMessage.ts +12 -5
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/eventlog/SqlEventJournal.ts +2 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +1 -1
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +6 -3
- package/src/unstable/http/Cookies.ts +64 -45
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/Headers.ts +10 -10
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientRequest.ts +59 -0
- package/src/unstable/http/HttpClientResponse.ts +4 -4
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +95 -0
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +9 -8
- package/src/unstable/http/HttpServerResponse.ts +30 -0
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +22 -19
- package/src/unstable/http/Template.ts +1 -1
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +27 -32
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/httpapi/HttpApi.ts +3 -3
- package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
- package/src/unstable/httpapi/HttpApiClient.ts +19 -19
- package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiGroup.ts +16 -16
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
- package/src/unstable/httpapi/OpenApi.ts +65 -41
- package/src/unstable/observability/OtlpExporter.ts +126 -10
- package/src/unstable/observability/OtlpLogger.ts +5 -5
- package/src/unstable/observability/OtlpMetrics.ts +12 -5
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +11 -10
- package/src/unstable/persistence/PersistedQueue.ts +6 -6
- package/src/unstable/persistence/Persistence.ts +126 -19
- package/src/unstable/persistence/RateLimiter.ts +28 -17
- package/src/unstable/persistence/Redis.ts +4 -4
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +22 -11
- package/src/unstable/reactivity/AsyncResult.ts +16 -16
- package/src/unstable/reactivity/Atom.ts +117 -22
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +25 -4
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +18 -16
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +19 -29
- package/src/unstable/socket/Socket.ts +18 -5
- package/src/unstable/sql/SqlClient.ts +5 -6
- package/src/unstable/sql/SqlError.ts +2 -2
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +5 -5
- package/src/unstable/sql/Statement.ts +31 -29
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +7 -7
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/SchemaUtils.d.ts +0 -28
- package/dist/SchemaUtils.d.ts.map +0 -1
- package/dist/SchemaUtils.js +0 -45
- package/dist/SchemaUtils.js.map +0 -1
- package/dist/internal/schema/arbitrary.d.ts.map +0 -1
- package/dist/internal/schema/arbitrary.js.map +0 -1
- package/dist/internal/schema/equivalence.d.ts +0 -2
- package/dist/internal/schema/equivalence.d.ts.map +0 -1
- package/dist/internal/schema/equivalence.js.map +0 -1
- package/dist/internal/schema/representation.d.ts +0 -2
- package/dist/internal/schema/representation.d.ts.map +0 -1
- package/dist/internal/schema/representation.js +0 -865
- package/dist/internal/schema/representation.js.map +0 -1
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/src/SchemaUtils.ts +0 -51
- package/src/internal/schema/representation.ts +0 -795
- package/src/internal/version.ts +0 -2
package/src/DateTime.ts
CHANGED
|
@@ -353,21 +353,21 @@ export declare namespace TimeZone {
|
|
|
353
353
|
*
|
|
354
354
|
* **Example** (Resolving ambiguous local times)
|
|
355
355
|
*
|
|
356
|
-
* ```ts
|
|
357
|
-
* import { DateTime } from "effect"
|
|
356
|
+
* ```ts import.meta.vitest
|
|
357
|
+
* import { DateTime, Option } from "effect"
|
|
358
358
|
*
|
|
359
359
|
* // Fall-back example: 01:30 on Nov 2, 2025 in New York happens twice
|
|
360
|
-
* const ambiguousTime = { year: 2025, month: 11, day: 2,
|
|
360
|
+
* const ambiguousTime = { year: 2025, month: 11, day: 2, hour: 1, minute: 30 }
|
|
361
361
|
* const timeZone = DateTime.zoneMakeNamedUnsafe("America/New_York")
|
|
362
362
|
*
|
|
363
|
-
* DateTime.makeZoned(ambiguousTime, {
|
|
363
|
+
* const earlier = DateTime.makeZoned(ambiguousTime, {
|
|
364
364
|
* timeZone,
|
|
365
365
|
* adjustForTimeZone: true,
|
|
366
366
|
* disambiguation: "earlier"
|
|
367
367
|
* })
|
|
368
368
|
* // Earlier occurrence (DST time): 2025-11-02T05:30:00.000Z
|
|
369
369
|
*
|
|
370
|
-
* DateTime.makeZoned(ambiguousTime, {
|
|
370
|
+
* const later = DateTime.makeZoned(ambiguousTime, {
|
|
371
371
|
* timeZone,
|
|
372
372
|
* adjustForTimeZone: true,
|
|
373
373
|
* disambiguation: "later"
|
|
@@ -375,21 +375,26 @@ export declare namespace TimeZone {
|
|
|
375
375
|
* // Later occurrence (standard time): 2025-11-02T06:30:00.000Z
|
|
376
376
|
*
|
|
377
377
|
* // Gap example: 02:30 on Mar 9, 2025 in New York doesn't exist
|
|
378
|
-
* const gapTime = { year: 2025, month: 3, day: 9,
|
|
378
|
+
* const gapTime = { year: 2025, month: 3, day: 9, hour: 2, minute: 30 }
|
|
379
379
|
*
|
|
380
|
-
* DateTime.makeZoned(gapTime, {
|
|
380
|
+
* const beforeGap = DateTime.makeZoned(gapTime, {
|
|
381
381
|
* timeZone,
|
|
382
382
|
* adjustForTimeZone: true,
|
|
383
383
|
* disambiguation: "earlier"
|
|
384
384
|
* })
|
|
385
385
|
* // Time before gap: 2025-03-09T06:30:00.000Z (01:30 EST)
|
|
386
386
|
*
|
|
387
|
-
* DateTime.makeZoned(gapTime, {
|
|
387
|
+
* const afterGap = DateTime.makeZoned(gapTime, {
|
|
388
388
|
* timeZone,
|
|
389
389
|
* adjustForTimeZone: true,
|
|
390
390
|
* disambiguation: "later"
|
|
391
391
|
* })
|
|
392
392
|
* // Time after gap: 2025-03-09T07:30:00.000Z (03:30 EDT)
|
|
393
|
+
*
|
|
394
|
+
* earlier.pipe(Option.getOrThrow, DateTime.formatIso) // => "2025-11-02T05:30:00.000Z"
|
|
395
|
+
* later.pipe(Option.getOrThrow, DateTime.formatIso) // => "2025-11-02T06:30:00.000Z"
|
|
396
|
+
* beforeGap.pipe(Option.getOrThrow, DateTime.formatIso) // => "2025-03-09T06:30:00.000Z"
|
|
397
|
+
* afterGap.pipe(Option.getOrThrow, DateTime.formatIso) // => "2025-03-09T07:30:00.000Z"
|
|
393
398
|
* ```
|
|
394
399
|
*
|
|
395
400
|
* @category models
|
|
@@ -510,7 +515,7 @@ export const isZoned: (self: DateTime) => self is Zoned = Internal.isZoned
|
|
|
510
515
|
*
|
|
511
516
|
* **Example** (Comparing DateTime values for equivalence)
|
|
512
517
|
*
|
|
513
|
-
* ```ts
|
|
518
|
+
* ```ts import.meta.vitest
|
|
514
519
|
* import { DateTime } from "effect"
|
|
515
520
|
*
|
|
516
521
|
* const utc = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
@@ -518,7 +523,7 @@ export const isZoned: (self: DateTime) => self is Zoned = Internal.isZoned
|
|
|
518
523
|
* timeZone: "Europe/London"
|
|
519
524
|
* })
|
|
520
525
|
*
|
|
521
|
-
*
|
|
526
|
+
* DateTime.Equivalence(utc, zoned) // => true
|
|
522
527
|
* ```
|
|
523
528
|
*
|
|
524
529
|
* @category instances
|
|
@@ -536,7 +541,7 @@ export const Equivalence: Equ.Equivalence<DateTime> = Internal.Equivalence
|
|
|
536
541
|
*
|
|
537
542
|
* **Example** (Sorting DateTime values chronologically)
|
|
538
543
|
*
|
|
539
|
-
* ```ts
|
|
544
|
+
* ```ts import.meta.vitest
|
|
540
545
|
* import { Array, DateTime } from "effect"
|
|
541
546
|
*
|
|
542
547
|
* const dates = [
|
|
@@ -545,8 +550,7 @@ export const Equivalence: Equ.Equivalence<DateTime> = Internal.Equivalence
|
|
|
545
550
|
* DateTime.makeUnsafe("2024-02-01")
|
|
546
551
|
* ]
|
|
547
552
|
*
|
|
548
|
-
*
|
|
549
|
-
* // Results in chronological order: 2024-01-01, 2024-02-01, 2024-03-01
|
|
553
|
+
* Array.sort(dates, DateTime.Order).map(DateTime.formatIsoDateUtc) // => ["2024-01-01", "2024-02-01", "2024-03-01"]
|
|
550
554
|
* ```
|
|
551
555
|
*
|
|
552
556
|
* @category instances
|
|
@@ -565,15 +569,14 @@ export const Order: order.Order<DateTime> = Internal.Order
|
|
|
565
569
|
*
|
|
566
570
|
* **Example** (Clamping DateTime values)
|
|
567
571
|
*
|
|
568
|
-
* ```ts
|
|
572
|
+
* ```ts import.meta.vitest
|
|
569
573
|
* import { DateTime } from "effect"
|
|
570
574
|
*
|
|
571
575
|
* const min = DateTime.makeUnsafe("2024-01-01")
|
|
572
576
|
* const max = DateTime.makeUnsafe("2024-12-31")
|
|
573
577
|
* const date = DateTime.makeUnsafe("2025-06-15")
|
|
574
578
|
*
|
|
575
|
-
*
|
|
576
|
-
* // clamped equals max (2024-12-31)
|
|
579
|
+
* DateTime.clamp(date, { minimum: min, maximum: max }) // => DateTime.makeUnsafe("2024-12-31")
|
|
577
580
|
* ```
|
|
578
581
|
*
|
|
579
582
|
* @category ordering
|
|
@@ -591,15 +594,14 @@ export const clamp: {
|
|
|
591
594
|
*
|
|
592
595
|
* **Example** (Clamping DateTime values)
|
|
593
596
|
*
|
|
594
|
-
* ```ts
|
|
597
|
+
* ```ts import.meta.vitest
|
|
595
598
|
* import { DateTime } from "effect"
|
|
596
599
|
*
|
|
597
600
|
* const min = DateTime.makeUnsafe("2024-01-01")
|
|
598
601
|
* const max = DateTime.makeUnsafe("2024-12-31")
|
|
599
602
|
* const date = DateTime.makeUnsafe("2025-06-15")
|
|
600
603
|
*
|
|
601
|
-
*
|
|
602
|
-
* // clamped equals max (2024-12-31)
|
|
604
|
+
* DateTime.clamp(date, { minimum: min, maximum: max }) // => DateTime.makeUnsafe("2024-12-31")
|
|
603
605
|
* ```
|
|
604
606
|
*
|
|
605
607
|
* @category ordering
|
|
@@ -617,15 +619,14 @@ export const clamp: {
|
|
|
617
619
|
*
|
|
618
620
|
* **Example** (Clamping DateTime values)
|
|
619
621
|
*
|
|
620
|
-
* ```ts
|
|
622
|
+
* ```ts import.meta.vitest
|
|
621
623
|
* import { DateTime } from "effect"
|
|
622
624
|
*
|
|
623
625
|
* const min = DateTime.makeUnsafe("2024-01-01")
|
|
624
626
|
* const max = DateTime.makeUnsafe("2024-12-31")
|
|
625
627
|
* const date = DateTime.makeUnsafe("2025-06-15")
|
|
626
628
|
*
|
|
627
|
-
*
|
|
628
|
-
* // clamped equals max (2024-12-31)
|
|
629
|
+
* DateTime.clamp(date, { minimum: min, maximum: max }) // => DateTime.makeUnsafe("2024-12-31")
|
|
629
630
|
* ```
|
|
630
631
|
*
|
|
631
632
|
* @category ordering
|
|
@@ -647,13 +648,10 @@ export const clamp: {
|
|
|
647
648
|
*
|
|
648
649
|
* **Example** (Creating DateTime values from Dates)
|
|
649
650
|
*
|
|
650
|
-
* ```ts
|
|
651
|
+
* ```ts import.meta.vitest
|
|
651
652
|
* import { DateTime } from "effect"
|
|
652
653
|
*
|
|
653
|
-
*
|
|
654
|
-
* const dateTime = DateTime.fromDateUnsafe(date)
|
|
655
|
-
*
|
|
656
|
-
* console.log(DateTime.formatIso(dateTime)) // "2024-01-01T12:00:00.000Z"
|
|
654
|
+
* DateTime.fromDateUnsafe(new Date("2024-01-01T12:00:00Z")) // => DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
657
655
|
* ```
|
|
658
656
|
*
|
|
659
657
|
* @category constructors
|
|
@@ -679,20 +677,17 @@ export const fromDateUnsafe: (date: Date) => Utc = Internal.fromDateUnsafe
|
|
|
679
677
|
*
|
|
680
678
|
* **Example** (Creating DateTime values unsafely)
|
|
681
679
|
*
|
|
682
|
-
* ```ts
|
|
680
|
+
* ```ts import.meta.vitest
|
|
683
681
|
* import { DateTime } from "effect"
|
|
684
682
|
*
|
|
685
683
|
* // from Date
|
|
686
|
-
*
|
|
687
|
-
* console.log(DateTime.formatIso(fromDate)) // "2024-01-01T12:00:00.000Z"
|
|
684
|
+
* DateTime.makeUnsafe(new Date("2024-01-01T12:00:00Z")) // => DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
688
685
|
*
|
|
689
686
|
* // from parts
|
|
690
|
-
*
|
|
691
|
-
* console.log(DateTime.formatIso(fromParts)) // "2024-01-01T00:00:00.000Z"
|
|
687
|
+
* DateTime.makeUnsafe({ year: 2024 }) // => DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
692
688
|
*
|
|
693
689
|
* // from string
|
|
694
|
-
*
|
|
695
|
-
* console.log(DateTime.formatIso(fromString)) // "2024-01-01T00:00:00.000Z"
|
|
690
|
+
* DateTime.makeUnsafe("2024-01-01") // => DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
696
691
|
* ```
|
|
697
692
|
*
|
|
698
693
|
* @category constructors
|
|
@@ -700,6 +695,22 @@ export const fromDateUnsafe: (date: Date) => Utc = Internal.fromDateUnsafe
|
|
|
700
695
|
*/
|
|
701
696
|
export const makeUnsafe: <A extends DateTime.Input>(input: A) => DateTime.PreserveZone<A> = Internal.makeUnsafe
|
|
702
697
|
|
|
698
|
+
/**
|
|
699
|
+
* Creates a `DateTime.Utc` from the number of seconds since the Unix epoch.
|
|
700
|
+
*
|
|
701
|
+
* **Example** (Creating from epoch seconds)
|
|
702
|
+
*
|
|
703
|
+
* ```ts import.meta.vitest
|
|
704
|
+
* import { DateTime } from "effect"
|
|
705
|
+
*
|
|
706
|
+
* DateTime.fromEpochSeconds(1704067200).toJSON() // => "2024-01-01T00:00:00.000Z"
|
|
707
|
+
* ```
|
|
708
|
+
*
|
|
709
|
+
* @category constructors
|
|
710
|
+
* @since 4.0.0
|
|
711
|
+
*/
|
|
712
|
+
export const fromEpochSeconds: (seconds: number) => Utc = Internal.fromEpochSeconds
|
|
713
|
+
|
|
703
714
|
/**
|
|
704
715
|
* Create a `DateTime.Zoned` using `DateTime.makeUnsafe` and a time zone.
|
|
705
716
|
*
|
|
@@ -723,14 +734,14 @@ export const makeUnsafe: <A extends DateTime.Input>(input: A) => DateTime.Preser
|
|
|
723
734
|
*
|
|
724
735
|
* **Example** (Creating zoned DateTime values unsafely)
|
|
725
736
|
*
|
|
726
|
-
* ```ts
|
|
737
|
+
* ```ts import.meta.vitest
|
|
727
738
|
* import { DateTime } from "effect"
|
|
728
739
|
*
|
|
729
740
|
* const zoned = DateTime.makeZonedUnsafe("2024-06-15T14:30:00Z", {
|
|
730
741
|
* timeZone: "Europe/London"
|
|
731
742
|
* })
|
|
732
743
|
*
|
|
733
|
-
*
|
|
744
|
+
* DateTime.formatIsoZoned(zoned) // => "2024-06-15T15:30:00.000+01:00[Europe/London]"
|
|
734
745
|
* ```
|
|
735
746
|
*
|
|
736
747
|
* @category constructors
|
|
@@ -765,17 +776,14 @@ export const makeZonedUnsafe: (input: DateTime.Input, options?: {
|
|
|
765
776
|
*
|
|
766
777
|
* **Example** (Creating optional zoned DateTime values)
|
|
767
778
|
*
|
|
768
|
-
* ```ts
|
|
769
|
-
* import { DateTime } from "effect"
|
|
779
|
+
* ```ts import.meta.vitest
|
|
780
|
+
* import { DateTime, Option } from "effect"
|
|
770
781
|
*
|
|
771
782
|
* const result = DateTime.makeZoned("2024-06-15T14:30:00Z", {
|
|
772
783
|
* timeZone: "Europe/London"
|
|
773
784
|
* })
|
|
774
785
|
*
|
|
775
|
-
*
|
|
776
|
-
* if (result._tag === "Some") {
|
|
777
|
-
* console.log(DateTime.formatIsoZoned(result.value)) // "2024-06-15T15:30:00.000+01:00[Europe/London]"
|
|
778
|
-
* }
|
|
786
|
+
* result.pipe(Option.map(DateTime.formatIsoZoned)) // => Option.some("2024-06-15T15:30:00.000+01:00[Europe/London]")
|
|
779
787
|
* ```
|
|
780
788
|
*
|
|
781
789
|
* @category constructors
|
|
@@ -807,23 +815,19 @@ export const makeZoned: (
|
|
|
807
815
|
*
|
|
808
816
|
* **Example** (Creating optional DateTime values)
|
|
809
817
|
*
|
|
810
|
-
* ```ts
|
|
811
|
-
* import { DateTime } from "effect"
|
|
818
|
+
* ```ts import.meta.vitest
|
|
819
|
+
* import { DateTime, Option } from "effect"
|
|
812
820
|
*
|
|
813
821
|
* // from Date
|
|
814
|
-
*
|
|
815
|
-
* console.log(fromDate._tag) // "Some"
|
|
822
|
+
* DateTime.make(new Date("2024-01-01T12:00:00Z")) // => Option.some(DateTime.makeUnsafe("2024-01-01T12:00:00Z"))
|
|
816
823
|
*
|
|
817
824
|
* // from parts
|
|
818
|
-
*
|
|
819
|
-
* console.log(fromParts._tag) // "Some"
|
|
825
|
+
* DateTime.make({ year: 2024 }) // => Option.some(DateTime.makeUnsafe("2024-01-01T00:00:00Z"))
|
|
820
826
|
*
|
|
821
827
|
* // from string
|
|
822
|
-
*
|
|
823
|
-
* console.log(fromString._tag) // "Some"
|
|
828
|
+
* DateTime.make("2024-01-01") // => Option.some(DateTime.makeUnsafe("2024-01-01T00:00:00Z"))
|
|
824
829
|
*
|
|
825
|
-
*
|
|
826
|
-
* console.log(invalid._tag) // "None"
|
|
830
|
+
* DateTime.make("not a date") // => Option.none()
|
|
827
831
|
* ```
|
|
828
832
|
*
|
|
829
833
|
* @category constructors
|
|
@@ -843,19 +847,15 @@ export const make: <A extends DateTime.Input>(input: A) => Option.Option<DateTim
|
|
|
843
847
|
*
|
|
844
848
|
* **Example** (Parsing zoned DateTime strings)
|
|
845
849
|
*
|
|
846
|
-
* ```ts
|
|
847
|
-
* import { DateTime } from "effect"
|
|
850
|
+
* ```ts import.meta.vitest
|
|
851
|
+
* import { DateTime, Option } from "effect"
|
|
848
852
|
*
|
|
849
|
-
*
|
|
853
|
+
* DateTime.makeZonedFromString(
|
|
850
854
|
* "2024-01-01T12:00:00+02:00[Europe/Berlin]"
|
|
851
|
-
* )
|
|
852
|
-
* console.log(result1._tag === "Some") // true
|
|
855
|
+
* ).pipe(Option.map(DateTime.formatIsoZoned)) // => Option.some("2024-01-01T11:00:00.000+01:00[Europe/Berlin]")
|
|
853
856
|
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
* const invalid = DateTime.makeZonedFromString("invalid")
|
|
858
|
-
* console.log(invalid._tag === "None") // true
|
|
857
|
+
* DateTime.makeZonedFromString("2024-01-01T12:00:00Z") // => Option.none()
|
|
858
|
+
* DateTime.makeZonedFromString("invalid") // => Option.none()
|
|
859
859
|
* ```
|
|
860
860
|
*
|
|
861
861
|
* @category constructors
|
|
@@ -864,17 +864,15 @@ export const make: <A extends DateTime.Input>(input: A) => Option.Option<DateTim
|
|
|
864
864
|
export const makeZonedFromString: (input: string) => Option.Option<Zoned> = Internal.makeZonedFromString
|
|
865
865
|
|
|
866
866
|
/**
|
|
867
|
-
* Gets the current time using the `Clock` service and
|
|
867
|
+
* Gets the current time using the `Clock` service and converts it to a `DateTime`.
|
|
868
868
|
*
|
|
869
869
|
* **Example** (Getting the current DateTime)
|
|
870
870
|
*
|
|
871
|
-
* ```ts
|
|
871
|
+
* ```ts import.meta.vitest
|
|
872
872
|
* import { DateTime, Effect } from "effect"
|
|
873
|
+
* import { TestClock } from "effect/testing"
|
|
873
874
|
*
|
|
874
|
-
* Effect.
|
|
875
|
-
* const now = yield* DateTime.nowAsDate
|
|
876
|
-
* console.log(now instanceof Date) // true
|
|
877
|
-
* })
|
|
875
|
+
* await Effect.runPromise(Effect.map(DateTime.now, DateTime.isDateTime)) // => true
|
|
878
876
|
* ```
|
|
879
877
|
*
|
|
880
878
|
* @category constructors
|
|
@@ -888,12 +886,11 @@ export const now: Effect.Effect<Utc> = Internal.now
|
|
|
888
886
|
*
|
|
889
887
|
* **Example** (Getting the current Date)
|
|
890
888
|
*
|
|
891
|
-
* ```ts
|
|
889
|
+
* ```ts import.meta.vitest
|
|
892
890
|
* import { DateTime, Effect } from "effect"
|
|
891
|
+
* import { TestClock } from "effect/testing"
|
|
893
892
|
*
|
|
894
|
-
* Effect.
|
|
895
|
-
* const now = yield* DateTime.now
|
|
896
|
-
* })
|
|
893
|
+
* await Effect.runPromise(Effect.map(DateTime.nowAsDate, (now) => now instanceof Date)) // => true
|
|
897
894
|
* ```
|
|
898
895
|
*
|
|
899
896
|
* @category constructors
|
|
@@ -916,11 +913,10 @@ export const nowAsDate: Effect.Effect<Date> = Internal.nowAsDate
|
|
|
916
913
|
*
|
|
917
914
|
* **Example** (Getting the current DateTime unsafely)
|
|
918
915
|
*
|
|
919
|
-
* ```ts
|
|
916
|
+
* ```ts import.meta.vitest
|
|
920
917
|
* import { DateTime } from "effect"
|
|
921
918
|
*
|
|
922
|
-
*
|
|
923
|
-
* console.log(DateTime.formatIso(now))
|
|
919
|
+
* Number.isFinite(DateTime.toEpochMillis(DateTime.nowUnsafe())) // => true
|
|
924
920
|
* ```
|
|
925
921
|
*
|
|
926
922
|
* @category constructors
|
|
@@ -946,7 +942,7 @@ export const nowUnsafe: LazyArg<Utc> = Internal.nowUnsafe
|
|
|
946
942
|
*
|
|
947
943
|
* **Example** (Converting DateTime values to UTC)
|
|
948
944
|
*
|
|
949
|
-
* ```ts
|
|
945
|
+
* ```ts import.meta.vitest
|
|
950
946
|
* import { DateTime } from "effect"
|
|
951
947
|
*
|
|
952
948
|
* const now = DateTime.makeZonedUnsafe({ year: 2024 }, {
|
|
@@ -955,9 +951,10 @@ export const nowUnsafe: LazyArg<Utc> = Internal.nowUnsafe
|
|
|
955
951
|
*
|
|
956
952
|
* // set as UTC
|
|
957
953
|
* const utc: DateTime.Utc = DateTime.toUtc(now)
|
|
954
|
+
* utc // => DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
958
955
|
* ```
|
|
959
956
|
*
|
|
960
|
-
* @category
|
|
957
|
+
* @category converting
|
|
961
958
|
* @since 3.13.0
|
|
962
959
|
*/
|
|
963
960
|
export const toUtc: (self: DateTime) => Utc = Internal.toUtc
|
|
@@ -967,19 +964,16 @@ export const toUtc: (self: DateTime) => Utc = Internal.toUtc
|
|
|
967
964
|
*
|
|
968
965
|
* **Example** (Setting time zones)
|
|
969
966
|
*
|
|
970
|
-
* ```ts
|
|
971
|
-
* import { DateTime
|
|
967
|
+
* ```ts import.meta.vitest
|
|
968
|
+
* import { DateTime } from "effect"
|
|
972
969
|
*
|
|
973
|
-
*
|
|
974
|
-
*
|
|
975
|
-
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
970
|
+
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
971
|
+
* const zoned: DateTime.Zoned = DateTime.setZone(DateTime.makeUnsafe("2024-01-01"), zone)
|
|
976
972
|
*
|
|
977
|
-
*
|
|
978
|
-
* const zoned: DateTime.Zoned = DateTime.setZone(now, zone)
|
|
979
|
-
* })
|
|
973
|
+
* DateTime.isZoned(zoned) // => true
|
|
980
974
|
* ```
|
|
981
975
|
*
|
|
982
|
-
* @category
|
|
976
|
+
* @category transforming
|
|
983
977
|
* @since 3.6.0
|
|
984
978
|
*/
|
|
985
979
|
export const setZone: {
|
|
@@ -988,19 +982,16 @@ export const setZone: {
|
|
|
988
982
|
*
|
|
989
983
|
* **Example** (Setting time zones)
|
|
990
984
|
*
|
|
991
|
-
* ```ts
|
|
992
|
-
* import { DateTime
|
|
985
|
+
* ```ts import.meta.vitest
|
|
986
|
+
* import { DateTime } from "effect"
|
|
993
987
|
*
|
|
994
|
-
*
|
|
995
|
-
*
|
|
996
|
-
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
988
|
+
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
989
|
+
* const zoned: DateTime.Zoned = DateTime.setZone(DateTime.makeUnsafe("2024-01-01"), zone)
|
|
997
990
|
*
|
|
998
|
-
*
|
|
999
|
-
* const zoned: DateTime.Zoned = DateTime.setZone(now, zone)
|
|
1000
|
-
* })
|
|
991
|
+
* DateTime.isZoned(zoned) // => true
|
|
1001
992
|
* ```
|
|
1002
993
|
*
|
|
1003
|
-
* @category
|
|
994
|
+
* @category transforming
|
|
1004
995
|
* @since 3.6.0
|
|
1005
996
|
*/
|
|
1006
997
|
(
|
|
@@ -1015,19 +1006,16 @@ export const setZone: {
|
|
|
1015
1006
|
*
|
|
1016
1007
|
* **Example** (Setting time zones)
|
|
1017
1008
|
*
|
|
1018
|
-
* ```ts
|
|
1019
|
-
* import { DateTime
|
|
1009
|
+
* ```ts import.meta.vitest
|
|
1010
|
+
* import { DateTime } from "effect"
|
|
1020
1011
|
*
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
1023
|
-
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
1012
|
+
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
1013
|
+
* const zoned: DateTime.Zoned = DateTime.setZone(DateTime.makeUnsafe("2024-01-01"), zone)
|
|
1024
1014
|
*
|
|
1025
|
-
*
|
|
1026
|
-
* const zoned: DateTime.Zoned = DateTime.setZone(now, zone)
|
|
1027
|
-
* })
|
|
1015
|
+
* DateTime.isZoned(zoned) // => true
|
|
1028
1016
|
* ```
|
|
1029
1017
|
*
|
|
1030
|
-
* @category
|
|
1018
|
+
* @category transforming
|
|
1031
1019
|
* @since 3.6.0
|
|
1032
1020
|
*/
|
|
1033
1021
|
(
|
|
@@ -1049,18 +1037,16 @@ export const setZone: {
|
|
|
1049
1037
|
*
|
|
1050
1038
|
* **Example** (Setting fixed-offset time zones)
|
|
1051
1039
|
*
|
|
1052
|
-
* ```ts
|
|
1053
|
-
* import { DateTime
|
|
1040
|
+
* ```ts import.meta.vitest
|
|
1041
|
+
* import { DateTime } from "effect"
|
|
1054
1042
|
*
|
|
1055
|
-
*
|
|
1056
|
-
*
|
|
1043
|
+
* const dateTime = DateTime.makeUnsafe("2024-01-01")
|
|
1044
|
+
* const zoned: DateTime.Zoned = DateTime.setZoneOffset(dateTime, 3 * 60 * 60 * 1000)
|
|
1057
1045
|
*
|
|
1058
|
-
*
|
|
1059
|
-
* const zoned: DateTime.Zoned = DateTime.setZoneOffset(now, 3 * 60 * 60 * 1000)
|
|
1060
|
-
* })
|
|
1046
|
+
* DateTime.zoneToString(zoned.zone) // => "+03:00"
|
|
1061
1047
|
* ```
|
|
1062
1048
|
*
|
|
1063
|
-
* @category
|
|
1049
|
+
* @category transforming
|
|
1064
1050
|
* @since 3.6.0
|
|
1065
1051
|
*/
|
|
1066
1052
|
export const setZoneOffset: {
|
|
@@ -1073,18 +1059,16 @@ export const setZoneOffset: {
|
|
|
1073
1059
|
*
|
|
1074
1060
|
* **Example** (Setting fixed-offset time zones)
|
|
1075
1061
|
*
|
|
1076
|
-
* ```ts
|
|
1077
|
-
* import { DateTime
|
|
1062
|
+
* ```ts import.meta.vitest
|
|
1063
|
+
* import { DateTime } from "effect"
|
|
1078
1064
|
*
|
|
1079
|
-
*
|
|
1080
|
-
*
|
|
1065
|
+
* const dateTime = DateTime.makeUnsafe("2024-01-01")
|
|
1066
|
+
* const zoned: DateTime.Zoned = DateTime.setZoneOffset(dateTime, 3 * 60 * 60 * 1000)
|
|
1081
1067
|
*
|
|
1082
|
-
*
|
|
1083
|
-
* const zoned: DateTime.Zoned = DateTime.setZoneOffset(now, 3 * 60 * 60 * 1000)
|
|
1084
|
-
* })
|
|
1068
|
+
* DateTime.zoneToString(zoned.zone) // => "+03:00"
|
|
1085
1069
|
* ```
|
|
1086
1070
|
*
|
|
1087
|
-
* @category
|
|
1071
|
+
* @category transforming
|
|
1088
1072
|
* @since 3.6.0
|
|
1089
1073
|
*/
|
|
1090
1074
|
(
|
|
@@ -1103,18 +1087,16 @@ export const setZoneOffset: {
|
|
|
1103
1087
|
*
|
|
1104
1088
|
* **Example** (Setting fixed-offset time zones)
|
|
1105
1089
|
*
|
|
1106
|
-
* ```ts
|
|
1107
|
-
* import { DateTime
|
|
1090
|
+
* ```ts import.meta.vitest
|
|
1091
|
+
* import { DateTime } from "effect"
|
|
1108
1092
|
*
|
|
1109
|
-
*
|
|
1110
|
-
*
|
|
1093
|
+
* const dateTime = DateTime.makeUnsafe("2024-01-01")
|
|
1094
|
+
* const zoned: DateTime.Zoned = DateTime.setZoneOffset(dateTime, 3 * 60 * 60 * 1000)
|
|
1111
1095
|
*
|
|
1112
|
-
*
|
|
1113
|
-
* const zoned: DateTime.Zoned = DateTime.setZoneOffset(now, 3 * 60 * 60 * 1000)
|
|
1114
|
-
* })
|
|
1096
|
+
* DateTime.zoneToString(zoned.zone) // => "+03:00"
|
|
1115
1097
|
* ```
|
|
1116
1098
|
*
|
|
1117
|
-
* @category
|
|
1099
|
+
* @category transforming
|
|
1118
1100
|
* @since 3.6.0
|
|
1119
1101
|
*/
|
|
1120
1102
|
(
|
|
@@ -1141,20 +1123,17 @@ export const setZoneOffset: {
|
|
|
1141
1123
|
*
|
|
1142
1124
|
* **Example** (Creating named time zones unsafely)
|
|
1143
1125
|
*
|
|
1144
|
-
* ```ts
|
|
1126
|
+
* ```ts import.meta.vitest
|
|
1145
1127
|
* import { DateTime } from "effect"
|
|
1146
1128
|
*
|
|
1147
|
-
*
|
|
1148
|
-
*
|
|
1149
|
-
*
|
|
1150
|
-
* const tokyoZone = DateTime.zoneMakeNamedUnsafe("Asia/Tokyo")
|
|
1151
|
-
* console.log(DateTime.zoneToString(tokyoZone)) // "Asia/Tokyo"
|
|
1129
|
+
* DateTime.zoneToString(DateTime.zoneMakeNamedUnsafe("Europe/London")) // => "Europe/London"
|
|
1130
|
+
* DateTime.zoneToString(DateTime.zoneMakeNamedUnsafe("Asia/Tokyo")) // => "Asia/Tokyo"
|
|
1152
1131
|
*
|
|
1153
1132
|
* // This would throw an IllegalArgumentError:
|
|
1154
1133
|
* // DateTime.zoneMakeNamedUnsafe("Invalid/Zone")
|
|
1155
1134
|
* ```
|
|
1156
1135
|
*
|
|
1157
|
-
* @category
|
|
1136
|
+
* @category constructors
|
|
1158
1137
|
* @since 4.0.0
|
|
1159
1138
|
*/
|
|
1160
1139
|
export const zoneMakeNamedUnsafe: (zoneId: string) => TimeZone.Named = Internal.zoneMakeNamedUnsafe
|
|
@@ -1169,7 +1148,7 @@ export const zoneMakeNamedUnsafe: (zoneId: string) => TimeZone.Named = Internal.
|
|
|
1169
1148
|
*
|
|
1170
1149
|
* **Example** (Creating fixed-offset time zones)
|
|
1171
1150
|
*
|
|
1172
|
-
* ```ts
|
|
1151
|
+
* ```ts import.meta.vitest
|
|
1173
1152
|
* import { DateTime } from "effect"
|
|
1174
1153
|
*
|
|
1175
1154
|
* // Create a time zone with +3 hours offset
|
|
@@ -1178,9 +1157,10 @@ export const zoneMakeNamedUnsafe: (zoneId: string) => TimeZone.Named = Internal.
|
|
|
1178
1157
|
* const dt = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
|
|
1179
1158
|
* timeZone: zone
|
|
1180
1159
|
* })
|
|
1160
|
+
* DateTime.formatIsoZoned(dt) // => "2024-01-01T15:00:00.000+03:00"
|
|
1181
1161
|
* ```
|
|
1182
1162
|
*
|
|
1183
|
-
* @category
|
|
1163
|
+
* @category constructors
|
|
1184
1164
|
* @since 3.6.0
|
|
1185
1165
|
*/
|
|
1186
1166
|
export const zoneMakeOffset: (offset: number) => TimeZone.Offset = Internal.zoneMakeOffset
|
|
@@ -1194,17 +1174,14 @@ export const zoneMakeOffset: (offset: number) => TimeZone.Offset = Internal.zone
|
|
|
1194
1174
|
*
|
|
1195
1175
|
* **Example** (Creating optional named time zones)
|
|
1196
1176
|
*
|
|
1197
|
-
* ```ts
|
|
1198
|
-
* import { DateTime } from "effect"
|
|
1199
|
-
*
|
|
1200
|
-
* const validZone = DateTime.zoneMakeNamed("Europe/London")
|
|
1201
|
-
* console.log(validZone._tag === "Some") // true
|
|
1177
|
+
* ```ts import.meta.vitest
|
|
1178
|
+
* import { DateTime, Option } from "effect"
|
|
1202
1179
|
*
|
|
1203
|
-
*
|
|
1204
|
-
*
|
|
1180
|
+
* DateTime.zoneMakeNamed("Europe/London").pipe(Option.map(DateTime.zoneToString)) // => Option.some("Europe/London")
|
|
1181
|
+
* DateTime.zoneMakeNamed("Invalid/Zone") // => Option.none()
|
|
1205
1182
|
* ```
|
|
1206
1183
|
*
|
|
1207
|
-
* @category
|
|
1184
|
+
* @category constructors
|
|
1208
1185
|
* @since 3.6.0
|
|
1209
1186
|
*/
|
|
1210
1187
|
export const zoneMakeNamed: (zoneId: string) => Option.Option<TimeZone.Named> = Internal.zoneMakeNamed
|
|
@@ -1219,7 +1196,7 @@ export const zoneMakeNamed: (zoneId: string) => Option.Option<TimeZone.Named> =
|
|
|
1219
1196
|
*
|
|
1220
1197
|
* **Example** (Creating named time zones effectfully)
|
|
1221
1198
|
*
|
|
1222
|
-
* ```ts
|
|
1199
|
+
* ```ts import.meta.vitest
|
|
1223
1200
|
* import { DateTime, Effect } from "effect"
|
|
1224
1201
|
*
|
|
1225
1202
|
* const program = Effect.gen(function*() {
|
|
@@ -1227,9 +1204,11 @@ export const zoneMakeNamed: (zoneId: string) => Option.Option<TimeZone.Named> =
|
|
|
1227
1204
|
* const now = yield* DateTime.now
|
|
1228
1205
|
* return DateTime.setZone(now, zone)
|
|
1229
1206
|
* })
|
|
1207
|
+
*
|
|
1208
|
+
* DateTime.zoneToString((await Effect.runPromise(program)).zone) // => "Europe/London"
|
|
1230
1209
|
* ```
|
|
1231
1210
|
*
|
|
1232
|
-
* @category
|
|
1211
|
+
* @category constructors
|
|
1233
1212
|
* @since 3.6.0
|
|
1234
1213
|
*/
|
|
1235
1214
|
export const zoneMakeNamedEffect: (zoneId: string) => Effect.Effect<TimeZone.Named, IllegalArgumentError> =
|
|
@@ -1245,14 +1224,13 @@ export const zoneMakeNamedEffect: (zoneId: string) => Effect.Effect<TimeZone.Nam
|
|
|
1245
1224
|
*
|
|
1246
1225
|
* **Example** (Creating local time zones)
|
|
1247
1226
|
*
|
|
1248
|
-
* ```ts
|
|
1227
|
+
* ```ts import.meta.vitest
|
|
1249
1228
|
* import { DateTime } from "effect"
|
|
1250
1229
|
*
|
|
1251
|
-
*
|
|
1252
|
-
* console.log(DateTime.zoneToString(localZone)) // Output depends on system time zone
|
|
1230
|
+
* DateTime.isTimeZoneNamed(DateTime.zoneMakeLocal()) // => true
|
|
1253
1231
|
* ```
|
|
1254
1232
|
*
|
|
1255
|
-
* @category
|
|
1233
|
+
* @category constructors
|
|
1256
1234
|
* @since 3.6.0
|
|
1257
1235
|
*/
|
|
1258
1236
|
export const zoneMakeLocal: () => TimeZone.Named = Internal.zoneMakeLocal
|
|
@@ -1266,19 +1244,15 @@ export const zoneMakeLocal: () => TimeZone.Named = Internal.zoneMakeLocal
|
|
|
1266
1244
|
*
|
|
1267
1245
|
* **Example** (Parsing time zones)
|
|
1268
1246
|
*
|
|
1269
|
-
* ```ts
|
|
1270
|
-
* import { DateTime } from "effect"
|
|
1247
|
+
* ```ts import.meta.vitest
|
|
1248
|
+
* import { DateTime, Option } from "effect"
|
|
1271
1249
|
*
|
|
1272
|
-
*
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1275
|
-
*
|
|
1276
|
-
* console.log(namedZone._tag === "Some") // true
|
|
1277
|
-
* console.log(offsetZone._tag === "Some") // true
|
|
1278
|
-
* console.log(invalid._tag === "None") // true
|
|
1250
|
+
* DateTime.zoneFromString("Europe/London").pipe(Option.map(DateTime.zoneToString)) // => Option.some("Europe/London")
|
|
1251
|
+
* DateTime.zoneFromString("+03:00").pipe(Option.map(DateTime.zoneToString)) // => Option.some("+03:00")
|
|
1252
|
+
* DateTime.zoneFromString("invalid") // => Option.none()
|
|
1279
1253
|
* ```
|
|
1280
1254
|
*
|
|
1281
|
-
* @category
|
|
1255
|
+
* @category decoding
|
|
1282
1256
|
* @since 3.6.0
|
|
1283
1257
|
*/
|
|
1284
1258
|
export const zoneFromString: (zone: string) => Option.Option<TimeZone> = Internal.zoneFromString
|
|
@@ -1288,17 +1262,14 @@ export const zoneFromString: (zone: string) => Option.Option<TimeZone> = Interna
|
|
|
1288
1262
|
*
|
|
1289
1263
|
* **Example** (Formatting time zones)
|
|
1290
1264
|
*
|
|
1291
|
-
* ```ts
|
|
1265
|
+
* ```ts import.meta.vitest
|
|
1292
1266
|
* import { DateTime } from "effect"
|
|
1293
1267
|
*
|
|
1294
|
-
* //
|
|
1295
|
-
* DateTime.zoneToString(DateTime.
|
|
1296
|
-
*
|
|
1297
|
-
* // Outputs "Europe/London"
|
|
1298
|
-
* DateTime.zoneToString(DateTime.zoneMakeNamedUnsafe("Europe/London"))
|
|
1268
|
+
* DateTime.zoneToString(DateTime.zoneMakeOffset(3 * 60 * 60 * 1000)) // => "+03:00"
|
|
1269
|
+
* DateTime.zoneToString(DateTime.zoneMakeNamedUnsafe("Europe/London")) // => "Europe/London"
|
|
1299
1270
|
* ```
|
|
1300
1271
|
*
|
|
1301
|
-
* @category
|
|
1272
|
+
* @category encoding
|
|
1302
1273
|
* @since 3.6.0
|
|
1303
1274
|
*/
|
|
1304
1275
|
export const zoneToString: (self: TimeZone) => string = Internal.zoneToString
|
|
@@ -1309,17 +1280,16 @@ export const zoneToString: (self: TimeZone) => string = Internal.zoneToString
|
|
|
1309
1280
|
*
|
|
1310
1281
|
* **Example** (Setting named time zones safely)
|
|
1311
1282
|
*
|
|
1312
|
-
* ```ts
|
|
1313
|
-
* import { DateTime,
|
|
1283
|
+
* ```ts import.meta.vitest
|
|
1284
|
+
* import { DateTime, Option } from "effect"
|
|
1314
1285
|
*
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1319
|
-
* })
|
|
1286
|
+
* const dateTime = DateTime.makeUnsafe("2024-01-01")
|
|
1287
|
+
* const result = DateTime.setZoneNamed(dateTime, "Europe/London").pipe(Option.map(DateTime.formatIsoZoned))
|
|
1288
|
+
*
|
|
1289
|
+
* result // => Option.some("2024-01-01T00:00:00.000+00:00[Europe/London]")
|
|
1320
1290
|
* ```
|
|
1321
1291
|
*
|
|
1322
|
-
* @category
|
|
1292
|
+
* @category transforming
|
|
1323
1293
|
* @since 3.6.0
|
|
1324
1294
|
*/
|
|
1325
1295
|
export const setZoneNamed: {
|
|
@@ -1329,17 +1299,16 @@ export const setZoneNamed: {
|
|
|
1329
1299
|
*
|
|
1330
1300
|
* **Example** (Setting named time zones safely)
|
|
1331
1301
|
*
|
|
1332
|
-
* ```ts
|
|
1333
|
-
* import { DateTime,
|
|
1302
|
+
* ```ts import.meta.vitest
|
|
1303
|
+
* import { DateTime, Option } from "effect"
|
|
1334
1304
|
*
|
|
1335
|
-
*
|
|
1336
|
-
*
|
|
1337
|
-
*
|
|
1338
|
-
*
|
|
1339
|
-
* })
|
|
1305
|
+
* const dateTime = DateTime.makeUnsafe("2024-01-01")
|
|
1306
|
+
* const result = DateTime.setZoneNamed(dateTime, "Europe/London").pipe(Option.map(DateTime.formatIsoZoned))
|
|
1307
|
+
*
|
|
1308
|
+
* result // => Option.some("2024-01-01T00:00:00.000+00:00[Europe/London]")
|
|
1340
1309
|
* ```
|
|
1341
1310
|
*
|
|
1342
|
-
* @category
|
|
1311
|
+
* @category transforming
|
|
1343
1312
|
* @since 3.6.0
|
|
1344
1313
|
*/
|
|
1345
1314
|
(
|
|
@@ -1355,17 +1324,16 @@ export const setZoneNamed: {
|
|
|
1355
1324
|
*
|
|
1356
1325
|
* **Example** (Setting named time zones safely)
|
|
1357
1326
|
*
|
|
1358
|
-
* ```ts
|
|
1359
|
-
* import { DateTime,
|
|
1327
|
+
* ```ts import.meta.vitest
|
|
1328
|
+
* import { DateTime, Option } from "effect"
|
|
1360
1329
|
*
|
|
1361
|
-
*
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1365
|
-
* })
|
|
1330
|
+
* const dateTime = DateTime.makeUnsafe("2024-01-01")
|
|
1331
|
+
* const result = DateTime.setZoneNamed(dateTime, "Europe/London").pipe(Option.map(DateTime.formatIsoZoned))
|
|
1332
|
+
*
|
|
1333
|
+
* result // => Option.some("2024-01-01T00:00:00.000+00:00[Europe/London]")
|
|
1366
1334
|
* ```
|
|
1367
1335
|
*
|
|
1368
|
-
* @category
|
|
1336
|
+
* @category transforming
|
|
1369
1337
|
* @since 3.6.0
|
|
1370
1338
|
*/
|
|
1371
1339
|
(
|
|
@@ -1384,17 +1352,16 @@ export const setZoneNamed: {
|
|
|
1384
1352
|
*
|
|
1385
1353
|
* **Example** (Setting named time zones unsafely)
|
|
1386
1354
|
*
|
|
1387
|
-
* ```ts
|
|
1388
|
-
* import { DateTime
|
|
1355
|
+
* ```ts import.meta.vitest
|
|
1356
|
+
* import { DateTime } from "effect"
|
|
1389
1357
|
*
|
|
1390
|
-
*
|
|
1391
|
-
*
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1394
|
-
* })
|
|
1358
|
+
* const dateTime = DateTime.makeUnsafe("2024-01-01")
|
|
1359
|
+
* const zoned = DateTime.setZoneNamedUnsafe(dateTime, "Europe/London")
|
|
1360
|
+
*
|
|
1361
|
+
* DateTime.zoneToString(zoned.zone) // => "Europe/London"
|
|
1395
1362
|
* ```
|
|
1396
1363
|
*
|
|
1397
|
-
* @category
|
|
1364
|
+
* @category transforming
|
|
1398
1365
|
* @since 4.0.0
|
|
1399
1366
|
*/
|
|
1400
1367
|
export const setZoneNamedUnsafe: {
|
|
@@ -1404,17 +1371,16 @@ export const setZoneNamedUnsafe: {
|
|
|
1404
1371
|
*
|
|
1405
1372
|
* **Example** (Setting named time zones unsafely)
|
|
1406
1373
|
*
|
|
1407
|
-
* ```ts
|
|
1408
|
-
* import { DateTime
|
|
1374
|
+
* ```ts import.meta.vitest
|
|
1375
|
+
* import { DateTime } from "effect"
|
|
1409
1376
|
*
|
|
1410
|
-
*
|
|
1411
|
-
*
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1414
|
-
* })
|
|
1377
|
+
* const dateTime = DateTime.makeUnsafe("2024-01-01")
|
|
1378
|
+
* const zoned = DateTime.setZoneNamedUnsafe(dateTime, "Europe/London")
|
|
1379
|
+
*
|
|
1380
|
+
* DateTime.zoneToString(zoned.zone) // => "Europe/London"
|
|
1415
1381
|
* ```
|
|
1416
1382
|
*
|
|
1417
|
-
* @category
|
|
1383
|
+
* @category transforming
|
|
1418
1384
|
* @since 4.0.0
|
|
1419
1385
|
*/
|
|
1420
1386
|
(
|
|
@@ -1430,17 +1396,16 @@ export const setZoneNamedUnsafe: {
|
|
|
1430
1396
|
*
|
|
1431
1397
|
* **Example** (Setting named time zones unsafely)
|
|
1432
1398
|
*
|
|
1433
|
-
* ```ts
|
|
1434
|
-
* import { DateTime
|
|
1399
|
+
* ```ts import.meta.vitest
|
|
1400
|
+
* import { DateTime } from "effect"
|
|
1435
1401
|
*
|
|
1436
|
-
*
|
|
1437
|
-
*
|
|
1438
|
-
*
|
|
1439
|
-
*
|
|
1440
|
-
* })
|
|
1402
|
+
* const dateTime = DateTime.makeUnsafe("2024-01-01")
|
|
1403
|
+
* const zoned = DateTime.setZoneNamedUnsafe(dateTime, "Europe/London")
|
|
1404
|
+
*
|
|
1405
|
+
* DateTime.zoneToString(zoned.zone) // => "Europe/London"
|
|
1441
1406
|
* ```
|
|
1442
1407
|
*
|
|
1443
|
-
* @category
|
|
1408
|
+
* @category transforming
|
|
1444
1409
|
* @since 4.0.0
|
|
1445
1410
|
*/
|
|
1446
1411
|
(
|
|
@@ -1469,16 +1434,13 @@ export const setZoneNamedUnsafe: {
|
|
|
1469
1434
|
*
|
|
1470
1435
|
* **Example** (Measuring distance between DateTime values)
|
|
1471
1436
|
*
|
|
1472
|
-
* ```ts
|
|
1473
|
-
* import { DateTime,
|
|
1437
|
+
* ```ts import.meta.vitest
|
|
1438
|
+
* import { DateTime, Duration } from "effect"
|
|
1474
1439
|
*
|
|
1475
|
-
*
|
|
1476
|
-
*
|
|
1477
|
-
* const other = DateTime.add(now, { minutes: 1 })
|
|
1440
|
+
* const start = DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
1441
|
+
* const end = DateTime.add(start, { minutes: 1 })
|
|
1478
1442
|
*
|
|
1479
|
-
*
|
|
1480
|
-
* DateTime.distance(now, other)
|
|
1481
|
-
* })
|
|
1443
|
+
* DateTime.distance(start, end) // => Duration.minutes(1)
|
|
1482
1444
|
* ```
|
|
1483
1445
|
*
|
|
1484
1446
|
* @category comparisons
|
|
@@ -1501,16 +1463,13 @@ export const distance: {
|
|
|
1501
1463
|
*
|
|
1502
1464
|
* **Example** (Measuring distance between DateTime values)
|
|
1503
1465
|
*
|
|
1504
|
-
* ```ts
|
|
1505
|
-
* import { DateTime,
|
|
1466
|
+
* ```ts import.meta.vitest
|
|
1467
|
+
* import { DateTime, Duration } from "effect"
|
|
1506
1468
|
*
|
|
1507
|
-
*
|
|
1508
|
-
*
|
|
1509
|
-
* const other = DateTime.add(now, { minutes: 1 })
|
|
1469
|
+
* const start = DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
1470
|
+
* const end = DateTime.add(start, { minutes: 1 })
|
|
1510
1471
|
*
|
|
1511
|
-
*
|
|
1512
|
-
* DateTime.distance(now, other)
|
|
1513
|
-
* })
|
|
1472
|
+
* DateTime.distance(start, end) // => Duration.minutes(1)
|
|
1514
1473
|
* ```
|
|
1515
1474
|
*
|
|
1516
1475
|
* @category comparisons
|
|
@@ -1533,16 +1492,13 @@ export const distance: {
|
|
|
1533
1492
|
*
|
|
1534
1493
|
* **Example** (Measuring distance between DateTime values)
|
|
1535
1494
|
*
|
|
1536
|
-
* ```ts
|
|
1537
|
-
* import { DateTime,
|
|
1495
|
+
* ```ts import.meta.vitest
|
|
1496
|
+
* import { DateTime, Duration } from "effect"
|
|
1538
1497
|
*
|
|
1539
|
-
*
|
|
1540
|
-
*
|
|
1541
|
-
* const other = DateTime.add(now, { minutes: 1 })
|
|
1498
|
+
* const start = DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
1499
|
+
* const end = DateTime.add(start, { minutes: 1 })
|
|
1542
1500
|
*
|
|
1543
|
-
*
|
|
1544
|
-
* DateTime.distance(now, other)
|
|
1545
|
-
* })
|
|
1501
|
+
* DateTime.distance(start, end) // => Duration.minutes(1)
|
|
1546
1502
|
* ```
|
|
1547
1503
|
*
|
|
1548
1504
|
* @category comparisons
|
|
@@ -1556,14 +1512,13 @@ export const distance: {
|
|
|
1556
1512
|
*
|
|
1557
1513
|
* **Example** (Selecting the earlier DateTime)
|
|
1558
1514
|
*
|
|
1559
|
-
* ```ts
|
|
1515
|
+
* ```ts import.meta.vitest
|
|
1560
1516
|
* import { DateTime } from "effect"
|
|
1561
1517
|
*
|
|
1562
1518
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1563
1519
|
* const date2 = DateTime.makeUnsafe("2024-02-01")
|
|
1564
1520
|
*
|
|
1565
|
-
*
|
|
1566
|
-
* // earlier equals date1 (2024-01-01)
|
|
1521
|
+
* DateTime.min(date1, date2) // => DateTime.makeUnsafe("2024-01-01")
|
|
1567
1522
|
* ```
|
|
1568
1523
|
*
|
|
1569
1524
|
* @category comparisons
|
|
@@ -1575,14 +1530,13 @@ export const min: {
|
|
|
1575
1530
|
*
|
|
1576
1531
|
* **Example** (Selecting the earlier DateTime)
|
|
1577
1532
|
*
|
|
1578
|
-
* ```ts
|
|
1533
|
+
* ```ts import.meta.vitest
|
|
1579
1534
|
* import { DateTime } from "effect"
|
|
1580
1535
|
*
|
|
1581
1536
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1582
1537
|
* const date2 = DateTime.makeUnsafe("2024-02-01")
|
|
1583
1538
|
*
|
|
1584
|
-
*
|
|
1585
|
-
* // earlier equals date1 (2024-01-01)
|
|
1539
|
+
* DateTime.min(date1, date2) // => DateTime.makeUnsafe("2024-01-01")
|
|
1586
1540
|
* ```
|
|
1587
1541
|
*
|
|
1588
1542
|
* @category comparisons
|
|
@@ -1594,14 +1548,13 @@ export const min: {
|
|
|
1594
1548
|
*
|
|
1595
1549
|
* **Example** (Selecting the earlier DateTime)
|
|
1596
1550
|
*
|
|
1597
|
-
* ```ts
|
|
1551
|
+
* ```ts import.meta.vitest
|
|
1598
1552
|
* import { DateTime } from "effect"
|
|
1599
1553
|
*
|
|
1600
1554
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1601
1555
|
* const date2 = DateTime.makeUnsafe("2024-02-01")
|
|
1602
1556
|
*
|
|
1603
|
-
*
|
|
1604
|
-
* // earlier equals date1 (2024-01-01)
|
|
1557
|
+
* DateTime.min(date1, date2) // => DateTime.makeUnsafe("2024-01-01")
|
|
1605
1558
|
* ```
|
|
1606
1559
|
*
|
|
1607
1560
|
* @category comparisons
|
|
@@ -1615,14 +1568,13 @@ export const min: {
|
|
|
1615
1568
|
*
|
|
1616
1569
|
* **Example** (Selecting the later DateTime)
|
|
1617
1570
|
*
|
|
1618
|
-
* ```ts
|
|
1571
|
+
* ```ts import.meta.vitest
|
|
1619
1572
|
* import { DateTime } from "effect"
|
|
1620
1573
|
*
|
|
1621
1574
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1622
1575
|
* const date2 = DateTime.makeUnsafe("2024-02-01")
|
|
1623
1576
|
*
|
|
1624
|
-
*
|
|
1625
|
-
* // later equals date2 (2024-02-01)
|
|
1577
|
+
* DateTime.max(date1, date2) // => DateTime.makeUnsafe("2024-02-01")
|
|
1626
1578
|
* ```
|
|
1627
1579
|
*
|
|
1628
1580
|
* @category comparisons
|
|
@@ -1634,14 +1586,13 @@ export const max: {
|
|
|
1634
1586
|
*
|
|
1635
1587
|
* **Example** (Selecting the later DateTime)
|
|
1636
1588
|
*
|
|
1637
|
-
* ```ts
|
|
1589
|
+
* ```ts import.meta.vitest
|
|
1638
1590
|
* import { DateTime } from "effect"
|
|
1639
1591
|
*
|
|
1640
1592
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1641
1593
|
* const date2 = DateTime.makeUnsafe("2024-02-01")
|
|
1642
1594
|
*
|
|
1643
|
-
*
|
|
1644
|
-
* // later equals date2 (2024-02-01)
|
|
1595
|
+
* DateTime.max(date1, date2) // => DateTime.makeUnsafe("2024-02-01")
|
|
1645
1596
|
* ```
|
|
1646
1597
|
*
|
|
1647
1598
|
* @category comparisons
|
|
@@ -1653,14 +1604,13 @@ export const max: {
|
|
|
1653
1604
|
*
|
|
1654
1605
|
* **Example** (Selecting the later DateTime)
|
|
1655
1606
|
*
|
|
1656
|
-
* ```ts
|
|
1607
|
+
* ```ts import.meta.vitest
|
|
1657
1608
|
* import { DateTime } from "effect"
|
|
1658
1609
|
*
|
|
1659
1610
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1660
1611
|
* const date2 = DateTime.makeUnsafe("2024-02-01")
|
|
1661
1612
|
*
|
|
1662
|
-
*
|
|
1663
|
-
* // later equals date2 (2024-02-01)
|
|
1613
|
+
* DateTime.max(date1, date2) // => DateTime.makeUnsafe("2024-02-01")
|
|
1664
1614
|
* ```
|
|
1665
1615
|
*
|
|
1666
1616
|
* @category comparisons
|
|
@@ -1674,14 +1624,14 @@ export const max: {
|
|
|
1674
1624
|
*
|
|
1675
1625
|
* **Example** (Checking whether a DateTime is later)
|
|
1676
1626
|
*
|
|
1677
|
-
* ```ts
|
|
1627
|
+
* ```ts import.meta.vitest
|
|
1678
1628
|
* import { DateTime } from "effect"
|
|
1679
1629
|
*
|
|
1680
1630
|
* const date1 = DateTime.makeUnsafe("2024-02-01")
|
|
1681
1631
|
* const date2 = DateTime.makeUnsafe("2024-01-01")
|
|
1682
1632
|
*
|
|
1683
|
-
*
|
|
1684
|
-
*
|
|
1633
|
+
* DateTime.isGreaterThan(date1, date2) // => true
|
|
1634
|
+
* DateTime.isGreaterThan(date2, date1) // => false
|
|
1685
1635
|
* ```
|
|
1686
1636
|
*
|
|
1687
1637
|
* @category comparisons
|
|
@@ -1693,14 +1643,14 @@ export const isGreaterThan: {
|
|
|
1693
1643
|
*
|
|
1694
1644
|
* **Example** (Checking whether a DateTime is later)
|
|
1695
1645
|
*
|
|
1696
|
-
* ```ts
|
|
1646
|
+
* ```ts import.meta.vitest
|
|
1697
1647
|
* import { DateTime } from "effect"
|
|
1698
1648
|
*
|
|
1699
1649
|
* const date1 = DateTime.makeUnsafe("2024-02-01")
|
|
1700
1650
|
* const date2 = DateTime.makeUnsafe("2024-01-01")
|
|
1701
1651
|
*
|
|
1702
|
-
*
|
|
1703
|
-
*
|
|
1652
|
+
* DateTime.isGreaterThan(date1, date2) // => true
|
|
1653
|
+
* DateTime.isGreaterThan(date2, date1) // => false
|
|
1704
1654
|
* ```
|
|
1705
1655
|
*
|
|
1706
1656
|
* @category comparisons
|
|
@@ -1712,14 +1662,14 @@ export const isGreaterThan: {
|
|
|
1712
1662
|
*
|
|
1713
1663
|
* **Example** (Checking whether a DateTime is later)
|
|
1714
1664
|
*
|
|
1715
|
-
* ```ts
|
|
1665
|
+
* ```ts import.meta.vitest
|
|
1716
1666
|
* import { DateTime } from "effect"
|
|
1717
1667
|
*
|
|
1718
1668
|
* const date1 = DateTime.makeUnsafe("2024-02-01")
|
|
1719
1669
|
* const date2 = DateTime.makeUnsafe("2024-01-01")
|
|
1720
1670
|
*
|
|
1721
|
-
*
|
|
1722
|
-
*
|
|
1671
|
+
* DateTime.isGreaterThan(date1, date2) // => true
|
|
1672
|
+
* DateTime.isGreaterThan(date2, date1) // => false
|
|
1723
1673
|
* ```
|
|
1724
1674
|
*
|
|
1725
1675
|
* @category comparisons
|
|
@@ -1733,16 +1683,16 @@ export const isGreaterThan: {
|
|
|
1733
1683
|
*
|
|
1734
1684
|
* **Example** (Checking whether a DateTime is later or equal)
|
|
1735
1685
|
*
|
|
1736
|
-
* ```ts
|
|
1686
|
+
* ```ts import.meta.vitest
|
|
1737
1687
|
* import { DateTime } from "effect"
|
|
1738
1688
|
*
|
|
1739
1689
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1740
1690
|
* const date2 = DateTime.makeUnsafe("2024-01-01")
|
|
1741
1691
|
* const date3 = DateTime.makeUnsafe("2024-02-01")
|
|
1742
1692
|
*
|
|
1743
|
-
*
|
|
1744
|
-
*
|
|
1745
|
-
*
|
|
1693
|
+
* DateTime.isGreaterThanOrEqualTo(date1, date2) // => true
|
|
1694
|
+
* DateTime.isGreaterThanOrEqualTo(date3, date1) // => true
|
|
1695
|
+
* DateTime.isGreaterThanOrEqualTo(date1, date3) // => false
|
|
1746
1696
|
* ```
|
|
1747
1697
|
*
|
|
1748
1698
|
* @category comparisons
|
|
@@ -1754,16 +1704,16 @@ export const isGreaterThanOrEqualTo: {
|
|
|
1754
1704
|
*
|
|
1755
1705
|
* **Example** (Checking whether a DateTime is later or equal)
|
|
1756
1706
|
*
|
|
1757
|
-
* ```ts
|
|
1707
|
+
* ```ts import.meta.vitest
|
|
1758
1708
|
* import { DateTime } from "effect"
|
|
1759
1709
|
*
|
|
1760
1710
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1761
1711
|
* const date2 = DateTime.makeUnsafe("2024-01-01")
|
|
1762
1712
|
* const date3 = DateTime.makeUnsafe("2024-02-01")
|
|
1763
1713
|
*
|
|
1764
|
-
*
|
|
1765
|
-
*
|
|
1766
|
-
*
|
|
1714
|
+
* DateTime.isGreaterThanOrEqualTo(date1, date2) // => true
|
|
1715
|
+
* DateTime.isGreaterThanOrEqualTo(date3, date1) // => true
|
|
1716
|
+
* DateTime.isGreaterThanOrEqualTo(date1, date3) // => false
|
|
1767
1717
|
* ```
|
|
1768
1718
|
*
|
|
1769
1719
|
* @category comparisons
|
|
@@ -1775,16 +1725,16 @@ export const isGreaterThanOrEqualTo: {
|
|
|
1775
1725
|
*
|
|
1776
1726
|
* **Example** (Checking whether a DateTime is later or equal)
|
|
1777
1727
|
*
|
|
1778
|
-
* ```ts
|
|
1728
|
+
* ```ts import.meta.vitest
|
|
1779
1729
|
* import { DateTime } from "effect"
|
|
1780
1730
|
*
|
|
1781
1731
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1782
1732
|
* const date2 = DateTime.makeUnsafe("2024-01-01")
|
|
1783
1733
|
* const date3 = DateTime.makeUnsafe("2024-02-01")
|
|
1784
1734
|
*
|
|
1785
|
-
*
|
|
1786
|
-
*
|
|
1787
|
-
*
|
|
1735
|
+
* DateTime.isGreaterThanOrEqualTo(date1, date2) // => true
|
|
1736
|
+
* DateTime.isGreaterThanOrEqualTo(date3, date1) // => true
|
|
1737
|
+
* DateTime.isGreaterThanOrEqualTo(date1, date3) // => false
|
|
1788
1738
|
* ```
|
|
1789
1739
|
*
|
|
1790
1740
|
* @category comparisons
|
|
@@ -1798,14 +1748,14 @@ export const isGreaterThanOrEqualTo: {
|
|
|
1798
1748
|
*
|
|
1799
1749
|
* **Example** (Checking whether a DateTime is earlier)
|
|
1800
1750
|
*
|
|
1801
|
-
* ```ts
|
|
1751
|
+
* ```ts import.meta.vitest
|
|
1802
1752
|
* import { DateTime } from "effect"
|
|
1803
1753
|
*
|
|
1804
1754
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1805
1755
|
* const date2 = DateTime.makeUnsafe("2024-02-01")
|
|
1806
1756
|
*
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1757
|
+
* DateTime.isLessThan(date1, date2) // => true
|
|
1758
|
+
* DateTime.isLessThan(date2, date1) // => false
|
|
1809
1759
|
* ```
|
|
1810
1760
|
*
|
|
1811
1761
|
* @category comparisons
|
|
@@ -1817,14 +1767,14 @@ export const isLessThan: {
|
|
|
1817
1767
|
*
|
|
1818
1768
|
* **Example** (Checking whether a DateTime is earlier)
|
|
1819
1769
|
*
|
|
1820
|
-
* ```ts
|
|
1770
|
+
* ```ts import.meta.vitest
|
|
1821
1771
|
* import { DateTime } from "effect"
|
|
1822
1772
|
*
|
|
1823
1773
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1824
1774
|
* const date2 = DateTime.makeUnsafe("2024-02-01")
|
|
1825
1775
|
*
|
|
1826
|
-
*
|
|
1827
|
-
*
|
|
1776
|
+
* DateTime.isLessThan(date1, date2) // => true
|
|
1777
|
+
* DateTime.isLessThan(date2, date1) // => false
|
|
1828
1778
|
* ```
|
|
1829
1779
|
*
|
|
1830
1780
|
* @category comparisons
|
|
@@ -1836,14 +1786,14 @@ export const isLessThan: {
|
|
|
1836
1786
|
*
|
|
1837
1787
|
* **Example** (Checking whether a DateTime is earlier)
|
|
1838
1788
|
*
|
|
1839
|
-
* ```ts
|
|
1789
|
+
* ```ts import.meta.vitest
|
|
1840
1790
|
* import { DateTime } from "effect"
|
|
1841
1791
|
*
|
|
1842
1792
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1843
1793
|
* const date2 = DateTime.makeUnsafe("2024-02-01")
|
|
1844
1794
|
*
|
|
1845
|
-
*
|
|
1846
|
-
*
|
|
1795
|
+
* DateTime.isLessThan(date1, date2) // => true
|
|
1796
|
+
* DateTime.isLessThan(date2, date1) // => false
|
|
1847
1797
|
* ```
|
|
1848
1798
|
*
|
|
1849
1799
|
* @category comparisons
|
|
@@ -1857,16 +1807,16 @@ export const isLessThan: {
|
|
|
1857
1807
|
*
|
|
1858
1808
|
* **Example** (Checking whether a DateTime is earlier or equal)
|
|
1859
1809
|
*
|
|
1860
|
-
* ```ts
|
|
1810
|
+
* ```ts import.meta.vitest
|
|
1861
1811
|
* import { DateTime } from "effect"
|
|
1862
1812
|
*
|
|
1863
1813
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1864
1814
|
* const date2 = DateTime.makeUnsafe("2024-01-01")
|
|
1865
1815
|
* const date3 = DateTime.makeUnsafe("2024-02-01")
|
|
1866
1816
|
*
|
|
1867
|
-
*
|
|
1868
|
-
*
|
|
1869
|
-
*
|
|
1817
|
+
* DateTime.isLessThanOrEqualTo(date1, date2) // => true
|
|
1818
|
+
* DateTime.isLessThanOrEqualTo(date1, date3) // => true
|
|
1819
|
+
* DateTime.isLessThanOrEqualTo(date3, date1) // => false
|
|
1870
1820
|
* ```
|
|
1871
1821
|
*
|
|
1872
1822
|
* @category comparisons
|
|
@@ -1878,16 +1828,16 @@ export const isLessThanOrEqualTo: {
|
|
|
1878
1828
|
*
|
|
1879
1829
|
* **Example** (Checking whether a DateTime is earlier or equal)
|
|
1880
1830
|
*
|
|
1881
|
-
* ```ts
|
|
1831
|
+
* ```ts import.meta.vitest
|
|
1882
1832
|
* import { DateTime } from "effect"
|
|
1883
1833
|
*
|
|
1884
1834
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1885
1835
|
* const date2 = DateTime.makeUnsafe("2024-01-01")
|
|
1886
1836
|
* const date3 = DateTime.makeUnsafe("2024-02-01")
|
|
1887
1837
|
*
|
|
1888
|
-
*
|
|
1889
|
-
*
|
|
1890
|
-
*
|
|
1838
|
+
* DateTime.isLessThanOrEqualTo(date1, date2) // => true
|
|
1839
|
+
* DateTime.isLessThanOrEqualTo(date1, date3) // => true
|
|
1840
|
+
* DateTime.isLessThanOrEqualTo(date3, date1) // => false
|
|
1891
1841
|
* ```
|
|
1892
1842
|
*
|
|
1893
1843
|
* @category comparisons
|
|
@@ -1899,16 +1849,16 @@ export const isLessThanOrEqualTo: {
|
|
|
1899
1849
|
*
|
|
1900
1850
|
* **Example** (Checking whether a DateTime is earlier or equal)
|
|
1901
1851
|
*
|
|
1902
|
-
* ```ts
|
|
1852
|
+
* ```ts import.meta.vitest
|
|
1903
1853
|
* import { DateTime } from "effect"
|
|
1904
1854
|
*
|
|
1905
1855
|
* const date1 = DateTime.makeUnsafe("2024-01-01")
|
|
1906
1856
|
* const date2 = DateTime.makeUnsafe("2024-01-01")
|
|
1907
1857
|
* const date3 = DateTime.makeUnsafe("2024-02-01")
|
|
1908
1858
|
*
|
|
1909
|
-
*
|
|
1910
|
-
*
|
|
1911
|
-
*
|
|
1859
|
+
* DateTime.isLessThanOrEqualTo(date1, date2) // => true
|
|
1860
|
+
* DateTime.isLessThanOrEqualTo(date1, date3) // => true
|
|
1861
|
+
* DateTime.isLessThanOrEqualTo(date3, date1) // => false
|
|
1912
1862
|
* ```
|
|
1913
1863
|
*
|
|
1914
1864
|
* @category comparisons
|
|
@@ -1922,14 +1872,14 @@ export const isLessThanOrEqualTo: {
|
|
|
1922
1872
|
*
|
|
1923
1873
|
* **Example** (Checking whether a DateTime is within bounds)
|
|
1924
1874
|
*
|
|
1925
|
-
* ```ts
|
|
1875
|
+
* ```ts import.meta.vitest
|
|
1926
1876
|
* import { DateTime } from "effect"
|
|
1927
1877
|
*
|
|
1928
1878
|
* const min = DateTime.makeUnsafe("2024-01-01")
|
|
1929
1879
|
* const max = DateTime.makeUnsafe("2024-12-31")
|
|
1930
1880
|
* const date = DateTime.makeUnsafe("2024-06-15")
|
|
1931
1881
|
*
|
|
1932
|
-
*
|
|
1882
|
+
* DateTime.between(date, { minimum: min, maximum: max }) // => true
|
|
1933
1883
|
* ```
|
|
1934
1884
|
*
|
|
1935
1885
|
* @category comparisons
|
|
@@ -1941,14 +1891,14 @@ export const between: {
|
|
|
1941
1891
|
*
|
|
1942
1892
|
* **Example** (Checking whether a DateTime is within bounds)
|
|
1943
1893
|
*
|
|
1944
|
-
* ```ts
|
|
1894
|
+
* ```ts import.meta.vitest
|
|
1945
1895
|
* import { DateTime } from "effect"
|
|
1946
1896
|
*
|
|
1947
1897
|
* const min = DateTime.makeUnsafe("2024-01-01")
|
|
1948
1898
|
* const max = DateTime.makeUnsafe("2024-12-31")
|
|
1949
1899
|
* const date = DateTime.makeUnsafe("2024-06-15")
|
|
1950
1900
|
*
|
|
1951
|
-
*
|
|
1901
|
+
* DateTime.between(date, { minimum: min, maximum: max }) // => true
|
|
1952
1902
|
* ```
|
|
1953
1903
|
*
|
|
1954
1904
|
* @category comparisons
|
|
@@ -1960,14 +1910,14 @@ export const between: {
|
|
|
1960
1910
|
*
|
|
1961
1911
|
* **Example** (Checking whether a DateTime is within bounds)
|
|
1962
1912
|
*
|
|
1963
|
-
* ```ts
|
|
1913
|
+
* ```ts import.meta.vitest
|
|
1964
1914
|
* import { DateTime } from "effect"
|
|
1965
1915
|
*
|
|
1966
1916
|
* const min = DateTime.makeUnsafe("2024-01-01")
|
|
1967
1917
|
* const max = DateTime.makeUnsafe("2024-12-31")
|
|
1968
1918
|
* const date = DateTime.makeUnsafe("2024-06-15")
|
|
1969
1919
|
*
|
|
1970
|
-
*
|
|
1920
|
+
* DateTime.between(date, { minimum: min, maximum: max }) // => true
|
|
1971
1921
|
* ```
|
|
1972
1922
|
*
|
|
1973
1923
|
* @category comparisons
|
|
@@ -1985,14 +1935,12 @@ export const between: {
|
|
|
1985
1935
|
*
|
|
1986
1936
|
* **Example** (Checking future DateTime values effectfully)
|
|
1987
1937
|
*
|
|
1988
|
-
* ```ts
|
|
1938
|
+
* ```ts import.meta.vitest
|
|
1989
1939
|
* import { DateTime, Effect } from "effect"
|
|
1940
|
+
* import { TestClock } from "effect/testing"
|
|
1990
1941
|
*
|
|
1991
|
-
* const
|
|
1992
|
-
*
|
|
1993
|
-
* const isFuture = yield* DateTime.isFuture(futureDate)
|
|
1994
|
-
* console.log(isFuture) // true
|
|
1995
|
-
* })
|
|
1942
|
+
* const futureDate = DateTime.makeUnsafe(1)
|
|
1943
|
+
* await Effect.runPromise(Effect.provide(DateTime.isFuture(futureDate), TestClock.layer())) // => true
|
|
1996
1944
|
* ```
|
|
1997
1945
|
*
|
|
1998
1946
|
* @category comparisons
|
|
@@ -2017,11 +1965,8 @@ export const isFuture: (self: DateTime) => Effect.Effect<boolean> = Internal.isF
|
|
|
2017
1965
|
* ```ts
|
|
2018
1966
|
* import { DateTime } from "effect"
|
|
2019
1967
|
*
|
|
2020
|
-
* const
|
|
2021
|
-
*
|
|
2022
|
-
*
|
|
2023
|
-
* console.log(DateTime.isFutureUnsafe(futureDate)) // true
|
|
2024
|
-
* console.log(DateTime.isFutureUnsafe(now)) // false
|
|
1968
|
+
* const oneHourFromNow = DateTime.add(DateTime.nowUnsafe(), { hours: 1 })
|
|
1969
|
+
* DateTime.isFutureUnsafe(oneHourFromNow)
|
|
2025
1970
|
* ```
|
|
2026
1971
|
*
|
|
2027
1972
|
* @category comparisons
|
|
@@ -2038,14 +1983,12 @@ export const isFutureUnsafe: (self: DateTime) => boolean = Internal.isFutureUnsa
|
|
|
2038
1983
|
*
|
|
2039
1984
|
* **Example** (Checking past DateTime values effectfully)
|
|
2040
1985
|
*
|
|
2041
|
-
* ```ts
|
|
1986
|
+
* ```ts import.meta.vitest
|
|
2042
1987
|
* import { DateTime, Effect } from "effect"
|
|
1988
|
+
* import { TestClock } from "effect/testing"
|
|
2043
1989
|
*
|
|
2044
|
-
* const
|
|
2045
|
-
*
|
|
2046
|
-
* const isPast = yield* DateTime.isPast(pastDate)
|
|
2047
|
-
* console.log(isPast) // true
|
|
2048
|
-
* })
|
|
1990
|
+
* const pastDate = DateTime.makeUnsafe(-1)
|
|
1991
|
+
* await Effect.runPromise(Effect.provide(DateTime.isPast(pastDate), TestClock.layer())) // => true
|
|
2049
1992
|
* ```
|
|
2050
1993
|
*
|
|
2051
1994
|
* @category comparisons
|
|
@@ -2070,11 +2013,8 @@ export const isPast: (self: DateTime) => Effect.Effect<boolean> = Internal.isPas
|
|
|
2070
2013
|
* ```ts
|
|
2071
2014
|
* import { DateTime } from "effect"
|
|
2072
2015
|
*
|
|
2073
|
-
* const
|
|
2074
|
-
*
|
|
2075
|
-
*
|
|
2076
|
-
* console.log(DateTime.isPastUnsafe(pastDate)) // true
|
|
2077
|
-
* console.log(DateTime.isPastUnsafe(now)) // false
|
|
2016
|
+
* const oneHourAgo = DateTime.subtract(DateTime.nowUnsafe(), { hours: 1 })
|
|
2017
|
+
* DateTime.isPastUnsafe(oneHourAgo)
|
|
2078
2018
|
* ```
|
|
2079
2019
|
*
|
|
2080
2020
|
* @category comparisons
|
|
@@ -2095,15 +2035,14 @@ export const isPastUnsafe: (self: DateTime) => boolean = Internal.isPastUnsafe
|
|
|
2095
2035
|
*
|
|
2096
2036
|
* **Example** (Converting DateTime values to UTC Dates)
|
|
2097
2037
|
*
|
|
2098
|
-
* ```ts
|
|
2038
|
+
* ```ts import.meta.vitest
|
|
2099
2039
|
* import { DateTime } from "effect"
|
|
2100
2040
|
*
|
|
2101
2041
|
* const dt = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
|
|
2102
2042
|
* timeZone: "Europe/London"
|
|
2103
2043
|
* })
|
|
2104
2044
|
*
|
|
2105
|
-
*
|
|
2106
|
-
* console.log(utcDate.toISOString()) // "2024-01-01T12:00:00.000Z"
|
|
2045
|
+
* DateTime.toDateUtc(dt).toISOString() // => "2024-01-01T12:00:00.000Z"
|
|
2107
2046
|
* ```
|
|
2108
2047
|
*
|
|
2109
2048
|
* @category converting
|
|
@@ -2121,7 +2060,7 @@ export const toDateUtc: (self: DateTime) => Date = Internal.toDateUtc
|
|
|
2121
2060
|
*
|
|
2122
2061
|
* **Example** (Converting DateTime values to Dates)
|
|
2123
2062
|
*
|
|
2124
|
-
* ```ts
|
|
2063
|
+
* ```ts import.meta.vitest
|
|
2125
2064
|
* import { DateTime } from "effect"
|
|
2126
2065
|
*
|
|
2127
2066
|
* const utc = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
@@ -2129,8 +2068,8 @@ export const toDateUtc: (self: DateTime) => Date = Internal.toDateUtc
|
|
|
2129
2068
|
* timeZone: "Europe/London"
|
|
2130
2069
|
* })
|
|
2131
2070
|
*
|
|
2132
|
-
*
|
|
2133
|
-
*
|
|
2071
|
+
* DateTime.toDate(utc).toISOString() // => "2024-01-01T12:00:00.000Z"
|
|
2072
|
+
* DateTime.toDate(zoned).toISOString() // => "2024-01-01T12:00:00.000Z"
|
|
2134
2073
|
* ```
|
|
2135
2074
|
*
|
|
2136
2075
|
* @category converting
|
|
@@ -2148,15 +2087,14 @@ export const toDate: (self: DateTime) => Date = Internal.toDate
|
|
|
2148
2087
|
*
|
|
2149
2088
|
* **Example** (Reading zoned offsets)
|
|
2150
2089
|
*
|
|
2151
|
-
* ```ts
|
|
2090
|
+
* ```ts import.meta.vitest
|
|
2152
2091
|
* import { DateTime } from "effect"
|
|
2153
2092
|
*
|
|
2154
2093
|
* const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
|
|
2155
2094
|
* timeZone: "Europe/London"
|
|
2156
2095
|
* })
|
|
2157
2096
|
*
|
|
2158
|
-
*
|
|
2159
|
-
* console.log(offset) // 0 (London is UTC+0 in winter)
|
|
2097
|
+
* DateTime.zonedOffset(zoned) // => 0
|
|
2160
2098
|
* ```
|
|
2161
2099
|
*
|
|
2162
2100
|
* @category converting
|
|
@@ -2173,15 +2111,14 @@ export const zonedOffset: (self: Zoned) => number = Internal.zonedOffset
|
|
|
2173
2111
|
*
|
|
2174
2112
|
* **Example** (Formatting zoned offsets)
|
|
2175
2113
|
*
|
|
2176
|
-
* ```ts
|
|
2114
|
+
* ```ts import.meta.vitest
|
|
2177
2115
|
* import { DateTime } from "effect"
|
|
2178
2116
|
*
|
|
2179
2117
|
* const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
|
|
2180
2118
|
* timeZone: DateTime.zoneMakeOffset(3 * 60 * 60 * 1000) // +3 hours
|
|
2181
2119
|
* })
|
|
2182
2120
|
*
|
|
2183
|
-
*
|
|
2184
|
-
* console.log(offsetString) // "+03:00"
|
|
2121
|
+
* DateTime.zonedOffsetIso(zoned) // => "+03:00"
|
|
2185
2122
|
* ```
|
|
2186
2123
|
*
|
|
2187
2124
|
* @category converting
|
|
@@ -2198,13 +2135,11 @@ export const zonedOffsetIso: (self: Zoned) => string = Internal.zonedOffsetIso
|
|
|
2198
2135
|
*
|
|
2199
2136
|
* **Example** (Reading epoch milliseconds)
|
|
2200
2137
|
*
|
|
2201
|
-
* ```ts
|
|
2138
|
+
* ```ts import.meta.vitest
|
|
2202
2139
|
* import { DateTime } from "effect"
|
|
2203
2140
|
*
|
|
2204
2141
|
* const dt = DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
2205
|
-
*
|
|
2206
|
-
*
|
|
2207
|
-
* console.log(epochMillis) // 1704067200000
|
|
2142
|
+
* DateTime.toEpochMillis(dt) // => 1704067200000
|
|
2208
2143
|
* ```
|
|
2209
2144
|
*
|
|
2210
2145
|
* @category converting
|
|
@@ -2212,13 +2147,35 @@ export const zonedOffsetIso: (self: Zoned) => string = Internal.zonedOffsetIso
|
|
|
2212
2147
|
*/
|
|
2213
2148
|
export const toEpochMillis: (self: DateTime) => number = Internal.toEpochMillis
|
|
2214
2149
|
|
|
2150
|
+
/**
|
|
2151
|
+
* Converts a `DateTime` to the number of seconds since the Unix epoch.
|
|
2152
|
+
*
|
|
2153
|
+
* **Details**
|
|
2154
|
+
*
|
|
2155
|
+
* This returns the UTC timestamp regardless of any time zone information.
|
|
2156
|
+
* The result is floored to the nearest second.
|
|
2157
|
+
*
|
|
2158
|
+
* **Example** (Reading epoch seconds)
|
|
2159
|
+
*
|
|
2160
|
+
* ```ts import.meta.vitest
|
|
2161
|
+
* import { DateTime } from "effect"
|
|
2162
|
+
*
|
|
2163
|
+
* const dt = DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
2164
|
+
* DateTime.toEpochSeconds(dt) // => 1704067200
|
|
2165
|
+
* ```
|
|
2166
|
+
*
|
|
2167
|
+
* @category converting
|
|
2168
|
+
* @since 4.0.0
|
|
2169
|
+
*/
|
|
2170
|
+
export const toEpochSeconds: (self: DateTime) => number = Internal.toEpochSeconds
|
|
2171
|
+
|
|
2215
2172
|
/**
|
|
2216
2173
|
* Removes the time aspect of a `DateTime`, first adjusting for the time
|
|
2217
2174
|
* zone. It will return a `DateTime.Utc` only containing the date.
|
|
2218
2175
|
*
|
|
2219
2176
|
* **Example** (Removing time components)
|
|
2220
2177
|
*
|
|
2221
|
-
* ```ts
|
|
2178
|
+
* ```ts import.meta.vitest
|
|
2222
2179
|
* import { DateTime } from "effect"
|
|
2223
2180
|
*
|
|
2224
2181
|
* // returns "2024-01-01T00:00:00Z"
|
|
@@ -2228,7 +2185,7 @@ export const toEpochMillis: (self: DateTime) => number = Internal.toEpochMillis
|
|
|
2228
2185
|
* }).pipe(
|
|
2229
2186
|
* DateTime.removeTime,
|
|
2230
2187
|
* DateTime.formatIso
|
|
2231
|
-
* )
|
|
2188
|
+
* ) // => "2024-01-01T00:00:00.000Z"
|
|
2232
2189
|
* ```
|
|
2233
2190
|
*
|
|
2234
2191
|
* @category converting
|
|
@@ -2249,26 +2206,16 @@ export const removeTime: (self: DateTime) => Utc = Internal.removeTime
|
|
|
2249
2206
|
*
|
|
2250
2207
|
* **Example** (Reading DateTime parts)
|
|
2251
2208
|
*
|
|
2252
|
-
* ```ts
|
|
2209
|
+
* ```ts import.meta.vitest
|
|
2253
2210
|
* import { DateTime } from "effect"
|
|
2254
2211
|
*
|
|
2255
2212
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:30:45.123Z")
|
|
2256
2213
|
* const parts = DateTime.toParts(dt)
|
|
2257
2214
|
*
|
|
2258
|
-
*
|
|
2259
|
-
* // {
|
|
2260
|
-
* // year: 2024,
|
|
2261
|
-
* // month: 1,
|
|
2262
|
-
* // day: 1,
|
|
2263
|
-
* // hours: 12,
|
|
2264
|
-
* // minutes: 30,
|
|
2265
|
-
* // seconds: 45,
|
|
2266
|
-
* // millis: 123,
|
|
2267
|
-
* // weekDay: 1 // Monday
|
|
2268
|
-
* // }
|
|
2215
|
+
* const selectedParts = [parts.year, parts.month, parts.day, parts.hour] // => [2024, 1, 1, 12]
|
|
2269
2216
|
* ```
|
|
2270
2217
|
*
|
|
2271
|
-
* @category
|
|
2218
|
+
* @category getters
|
|
2272
2219
|
* @since 3.6.0
|
|
2273
2220
|
*/
|
|
2274
2221
|
export const toParts: (self: DateTime) => DateTime.PartsWithWeekday = Internal.toParts
|
|
@@ -2282,7 +2229,7 @@ export const toParts: (self: DateTime) => DateTime.PartsWithWeekday = Internal.t
|
|
|
2282
2229
|
*
|
|
2283
2230
|
* **Example** (Reading UTC DateTime parts)
|
|
2284
2231
|
*
|
|
2285
|
-
* ```ts
|
|
2232
|
+
* ```ts import.meta.vitest
|
|
2286
2233
|
* import { DateTime } from "effect"
|
|
2287
2234
|
*
|
|
2288
2235
|
* const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:30:45.123Z", {
|
|
@@ -2290,11 +2237,10 @@ export const toParts: (self: DateTime) => DateTime.PartsWithWeekday = Internal.t
|
|
|
2290
2237
|
* })
|
|
2291
2238
|
* const parts = DateTime.toPartsUtc(zoned)
|
|
2292
2239
|
*
|
|
2293
|
-
*
|
|
2294
|
-
* // Always returns UTC parts regardless of time zone
|
|
2240
|
+
* const selectedParts = [parts.year, parts.month, parts.day, parts.hour] // => [2024, 1, 1, 12]
|
|
2295
2241
|
* ```
|
|
2296
2242
|
*
|
|
2297
|
-
* @category
|
|
2243
|
+
* @category getters
|
|
2298
2244
|
* @since 3.6.0
|
|
2299
2245
|
*/
|
|
2300
2246
|
export const toPartsUtc: (self: DateTime) => DateTime.PartsWithWeekday = Internal.toPartsUtc
|
|
@@ -2308,15 +2254,14 @@ export const toPartsUtc: (self: DateTime) => DateTime.PartsWithWeekday = Interna
|
|
|
2308
2254
|
*
|
|
2309
2255
|
* **Example** (Reading UTC DateTime parts by key)
|
|
2310
2256
|
*
|
|
2311
|
-
* ```ts
|
|
2257
|
+
* ```ts import.meta.vitest
|
|
2312
2258
|
* import { DateTime } from "effect"
|
|
2313
2259
|
*
|
|
2314
2260
|
* const dateTime = DateTime.makeUnsafe({ year: 2024 })
|
|
2315
|
-
*
|
|
2316
|
-
* console.log(year) // 2024
|
|
2261
|
+
* DateTime.getPartUtc(dateTime, "year") // => 2024
|
|
2317
2262
|
* ```
|
|
2318
2263
|
*
|
|
2319
|
-
* @category
|
|
2264
|
+
* @category getters
|
|
2320
2265
|
* @since 3.6.0
|
|
2321
2266
|
*/
|
|
2322
2267
|
export const getPartUtc: {
|
|
@@ -2329,15 +2274,14 @@ export const getPartUtc: {
|
|
|
2329
2274
|
*
|
|
2330
2275
|
* **Example** (Reading UTC DateTime parts by key)
|
|
2331
2276
|
*
|
|
2332
|
-
* ```ts
|
|
2277
|
+
* ```ts import.meta.vitest
|
|
2333
2278
|
* import { DateTime } from "effect"
|
|
2334
2279
|
*
|
|
2335
2280
|
* const dateTime = DateTime.makeUnsafe({ year: 2024 })
|
|
2336
|
-
*
|
|
2337
|
-
* console.log(year) // 2024
|
|
2281
|
+
* DateTime.getPartUtc(dateTime, "year") // => 2024
|
|
2338
2282
|
* ```
|
|
2339
2283
|
*
|
|
2340
|
-
* @category
|
|
2284
|
+
* @category getters
|
|
2341
2285
|
* @since 3.6.0
|
|
2342
2286
|
*/
|
|
2343
2287
|
(part: keyof DateTime.PartsWithWeekday): (self: DateTime) => number
|
|
@@ -2350,15 +2294,14 @@ export const getPartUtc: {
|
|
|
2350
2294
|
*
|
|
2351
2295
|
* **Example** (Reading UTC DateTime parts by key)
|
|
2352
2296
|
*
|
|
2353
|
-
* ```ts
|
|
2297
|
+
* ```ts import.meta.vitest
|
|
2354
2298
|
* import { DateTime } from "effect"
|
|
2355
2299
|
*
|
|
2356
2300
|
* const dateTime = DateTime.makeUnsafe({ year: 2024 })
|
|
2357
|
-
*
|
|
2358
|
-
* console.log(year) // 2024
|
|
2301
|
+
* DateTime.getPartUtc(dateTime, "year") // => 2024
|
|
2359
2302
|
* ```
|
|
2360
2303
|
*
|
|
2361
|
-
* @category
|
|
2304
|
+
* @category getters
|
|
2362
2305
|
* @since 3.6.0
|
|
2363
2306
|
*/
|
|
2364
2307
|
(self: DateTime, part: keyof DateTime.PartsWithWeekday): number
|
|
@@ -2373,17 +2316,16 @@ export const getPartUtc: {
|
|
|
2373
2316
|
*
|
|
2374
2317
|
* **Example** (Reading DateTime parts by key)
|
|
2375
2318
|
*
|
|
2376
|
-
* ```ts
|
|
2319
|
+
* ```ts import.meta.vitest
|
|
2377
2320
|
* import { DateTime } from "effect"
|
|
2378
2321
|
*
|
|
2379
2322
|
* const dateTime = DateTime.makeZonedUnsafe({ year: 2024 }, {
|
|
2380
2323
|
* timeZone: "Europe/London"
|
|
2381
2324
|
* })
|
|
2382
|
-
*
|
|
2383
|
-
* console.log(year) // 2024
|
|
2325
|
+
* DateTime.getPart(dateTime, "year") // => 2024
|
|
2384
2326
|
* ```
|
|
2385
2327
|
*
|
|
2386
|
-
* @category
|
|
2328
|
+
* @category getters
|
|
2387
2329
|
* @since 3.6.0
|
|
2388
2330
|
*/
|
|
2389
2331
|
export const getPart: {
|
|
@@ -2396,17 +2338,16 @@ export const getPart: {
|
|
|
2396
2338
|
*
|
|
2397
2339
|
* **Example** (Reading DateTime parts by key)
|
|
2398
2340
|
*
|
|
2399
|
-
* ```ts
|
|
2341
|
+
* ```ts import.meta.vitest
|
|
2400
2342
|
* import { DateTime } from "effect"
|
|
2401
2343
|
*
|
|
2402
2344
|
* const dateTime = DateTime.makeZonedUnsafe({ year: 2024 }, {
|
|
2403
2345
|
* timeZone: "Europe/London"
|
|
2404
2346
|
* })
|
|
2405
|
-
*
|
|
2406
|
-
* console.log(year) // 2024
|
|
2347
|
+
* DateTime.getPart(dateTime, "year") // => 2024
|
|
2407
2348
|
* ```
|
|
2408
2349
|
*
|
|
2409
|
-
* @category
|
|
2350
|
+
* @category getters
|
|
2410
2351
|
* @since 3.6.0
|
|
2411
2352
|
*/
|
|
2412
2353
|
(part: keyof DateTime.PartsWithWeekday): (self: DateTime) => number
|
|
@@ -2419,17 +2360,16 @@ export const getPart: {
|
|
|
2419
2360
|
*
|
|
2420
2361
|
* **Example** (Reading DateTime parts by key)
|
|
2421
2362
|
*
|
|
2422
|
-
* ```ts
|
|
2363
|
+
* ```ts import.meta.vitest
|
|
2423
2364
|
* import { DateTime } from "effect"
|
|
2424
2365
|
*
|
|
2425
2366
|
* const dateTime = DateTime.makeZonedUnsafe({ year: 2024 }, {
|
|
2426
2367
|
* timeZone: "Europe/London"
|
|
2427
2368
|
* })
|
|
2428
|
-
*
|
|
2429
|
-
* console.log(year) // 2024
|
|
2369
|
+
* DateTime.getPart(dateTime, "year") // => 2024
|
|
2430
2370
|
* ```
|
|
2431
2371
|
*
|
|
2432
|
-
* @category
|
|
2372
|
+
* @category getters
|
|
2433
2373
|
* @since 3.6.0
|
|
2434
2374
|
*/
|
|
2435
2375
|
(self: DateTime, part: keyof DateTime.PartsWithWeekday): number
|
|
@@ -2444,20 +2384,20 @@ export const getPart: {
|
|
|
2444
2384
|
*
|
|
2445
2385
|
* **Example** (Updating DateTime parts)
|
|
2446
2386
|
*
|
|
2447
|
-
* ```ts
|
|
2387
|
+
* ```ts import.meta.vitest
|
|
2448
2388
|
* import { DateTime } from "effect"
|
|
2449
2389
|
*
|
|
2450
|
-
* const dt = DateTime.
|
|
2390
|
+
* const dt = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", { timeZone: "UTC" })
|
|
2451
2391
|
* const updated = DateTime.setParts(dt, {
|
|
2452
2392
|
* year: 2025,
|
|
2453
2393
|
* month: 6,
|
|
2454
2394
|
* day: 15
|
|
2455
2395
|
* })
|
|
2456
2396
|
*
|
|
2457
|
-
*
|
|
2397
|
+
* updated // => DateTime.makeZonedUnsafe("2025-06-15T12:00:00Z", { timeZone: "UTC" })
|
|
2458
2398
|
* ```
|
|
2459
2399
|
*
|
|
2460
|
-
* @category
|
|
2400
|
+
* @category transforming
|
|
2461
2401
|
* @since 3.6.0
|
|
2462
2402
|
*/
|
|
2463
2403
|
export const setParts: {
|
|
@@ -2470,20 +2410,20 @@ export const setParts: {
|
|
|
2470
2410
|
*
|
|
2471
2411
|
* **Example** (Updating DateTime parts)
|
|
2472
2412
|
*
|
|
2473
|
-
* ```ts
|
|
2413
|
+
* ```ts import.meta.vitest
|
|
2474
2414
|
* import { DateTime } from "effect"
|
|
2475
2415
|
*
|
|
2476
|
-
* const dt = DateTime.
|
|
2416
|
+
* const dt = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", { timeZone: "UTC" })
|
|
2477
2417
|
* const updated = DateTime.setParts(dt, {
|
|
2478
2418
|
* year: 2025,
|
|
2479
2419
|
* month: 6,
|
|
2480
2420
|
* day: 15
|
|
2481
2421
|
* })
|
|
2482
2422
|
*
|
|
2483
|
-
*
|
|
2423
|
+
* updated // => DateTime.makeZonedUnsafe("2025-06-15T12:00:00Z", { timeZone: "UTC" })
|
|
2484
2424
|
* ```
|
|
2485
2425
|
*
|
|
2486
|
-
* @category
|
|
2426
|
+
* @category transforming
|
|
2487
2427
|
* @since 3.6.0
|
|
2488
2428
|
*/
|
|
2489
2429
|
(parts: Partial<DateTime.PartsWithWeekday>): <A extends DateTime>(self: A) => A
|
|
@@ -2496,20 +2436,20 @@ export const setParts: {
|
|
|
2496
2436
|
*
|
|
2497
2437
|
* **Example** (Updating DateTime parts)
|
|
2498
2438
|
*
|
|
2499
|
-
* ```ts
|
|
2439
|
+
* ```ts import.meta.vitest
|
|
2500
2440
|
* import { DateTime } from "effect"
|
|
2501
2441
|
*
|
|
2502
|
-
* const dt = DateTime.
|
|
2442
|
+
* const dt = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", { timeZone: "UTC" })
|
|
2503
2443
|
* const updated = DateTime.setParts(dt, {
|
|
2504
2444
|
* year: 2025,
|
|
2505
2445
|
* month: 6,
|
|
2506
2446
|
* day: 15
|
|
2507
2447
|
* })
|
|
2508
2448
|
*
|
|
2509
|
-
*
|
|
2449
|
+
* updated // => DateTime.makeZonedUnsafe("2025-06-15T12:00:00Z", { timeZone: "UTC" })
|
|
2510
2450
|
* ```
|
|
2511
2451
|
*
|
|
2512
|
-
* @category
|
|
2452
|
+
* @category transforming
|
|
2513
2453
|
* @since 3.6.0
|
|
2514
2454
|
*/
|
|
2515
2455
|
<A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): A
|
|
@@ -2524,7 +2464,7 @@ export const setParts: {
|
|
|
2524
2464
|
*
|
|
2525
2465
|
* **Example** (Updating UTC DateTime parts)
|
|
2526
2466
|
*
|
|
2527
|
-
* ```ts
|
|
2467
|
+
* ```ts import.meta.vitest
|
|
2528
2468
|
* import { DateTime } from "effect"
|
|
2529
2469
|
*
|
|
2530
2470
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
@@ -2533,10 +2473,10 @@ export const setParts: {
|
|
|
2533
2473
|
* hour: 18
|
|
2534
2474
|
* })
|
|
2535
2475
|
*
|
|
2536
|
-
*
|
|
2476
|
+
* updated // => DateTime.makeUnsafe("2025-01-01T18:00:00Z")
|
|
2537
2477
|
* ```
|
|
2538
2478
|
*
|
|
2539
|
-
* @category
|
|
2479
|
+
* @category transforming
|
|
2540
2480
|
* @since 3.6.0
|
|
2541
2481
|
*/
|
|
2542
2482
|
export const setPartsUtc: {
|
|
@@ -2549,7 +2489,7 @@ export const setPartsUtc: {
|
|
|
2549
2489
|
*
|
|
2550
2490
|
* **Example** (Updating UTC DateTime parts)
|
|
2551
2491
|
*
|
|
2552
|
-
* ```ts
|
|
2492
|
+
* ```ts import.meta.vitest
|
|
2553
2493
|
* import { DateTime } from "effect"
|
|
2554
2494
|
*
|
|
2555
2495
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
@@ -2558,10 +2498,10 @@ export const setPartsUtc: {
|
|
|
2558
2498
|
* hour: 18
|
|
2559
2499
|
* })
|
|
2560
2500
|
*
|
|
2561
|
-
*
|
|
2501
|
+
* updated // => DateTime.makeUnsafe("2025-01-01T18:00:00Z")
|
|
2562
2502
|
* ```
|
|
2563
2503
|
*
|
|
2564
|
-
* @category
|
|
2504
|
+
* @category transforming
|
|
2565
2505
|
* @since 3.6.0
|
|
2566
2506
|
*/
|
|
2567
2507
|
(parts: Partial<DateTime.PartsWithWeekday>): <A extends DateTime>(self: A) => A
|
|
@@ -2574,7 +2514,7 @@ export const setPartsUtc: {
|
|
|
2574
2514
|
*
|
|
2575
2515
|
* **Example** (Updating UTC DateTime parts)
|
|
2576
2516
|
*
|
|
2577
|
-
* ```ts
|
|
2517
|
+
* ```ts import.meta.vitest
|
|
2578
2518
|
* import { DateTime } from "effect"
|
|
2579
2519
|
*
|
|
2580
2520
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
@@ -2583,10 +2523,10 @@ export const setPartsUtc: {
|
|
|
2583
2523
|
* hour: 18
|
|
2584
2524
|
* })
|
|
2585
2525
|
*
|
|
2586
|
-
*
|
|
2526
|
+
* updated // => DateTime.makeUnsafe("2025-01-01T18:00:00Z")
|
|
2587
2527
|
* ```
|
|
2588
2528
|
*
|
|
2589
|
-
* @category
|
|
2529
|
+
* @category transforming
|
|
2590
2530
|
* @since 3.6.0
|
|
2591
2531
|
*/
|
|
2592
2532
|
<A extends DateTime>(self: A, parts: Partial<DateTime.PartsWithWeekday>): A
|
|
@@ -2608,21 +2548,19 @@ export const setPartsUtc: {
|
|
|
2608
2548
|
*
|
|
2609
2549
|
* **Example** (Accessing the current time zone service)
|
|
2610
2550
|
*
|
|
2611
|
-
* ```ts
|
|
2551
|
+
* ```ts import.meta.vitest
|
|
2612
2552
|
* import { DateTime, Effect } from "effect"
|
|
2613
2553
|
*
|
|
2614
2554
|
* const program = Effect.gen(function*() {
|
|
2615
|
-
*
|
|
2616
|
-
* const zone = yield* DateTime.CurrentTimeZone
|
|
2617
|
-
* console.log(DateTime.zoneToString(zone))
|
|
2555
|
+
* return DateTime.zoneToString(yield* DateTime.CurrentTimeZone)
|
|
2618
2556
|
* })
|
|
2619
2557
|
*
|
|
2620
2558
|
* // Provide a time zone
|
|
2621
2559
|
* const layer = DateTime.layerCurrentZoneNamed("Europe/London")
|
|
2622
|
-
* Effect.provide(program, layer)
|
|
2560
|
+
* await Effect.runPromise(Effect.provide(program, layer)) // => "Europe/London"
|
|
2623
2561
|
* ```
|
|
2624
2562
|
*
|
|
2625
|
-
* @category
|
|
2563
|
+
* @category services
|
|
2626
2564
|
* @since 3.11.0
|
|
2627
2565
|
*/
|
|
2628
2566
|
export class CurrentTimeZone extends Context.Service<CurrentTimeZone, TimeZone>()(
|
|
@@ -2635,18 +2573,16 @@ export class CurrentTimeZone extends Context.Service<CurrentTimeZone, TimeZone>(
|
|
|
2635
2573
|
*
|
|
2636
2574
|
* **Example** (Setting the current time zone)
|
|
2637
2575
|
*
|
|
2638
|
-
* ```ts
|
|
2576
|
+
* ```ts import.meta.vitest
|
|
2639
2577
|
* import { DateTime, Effect } from "effect"
|
|
2640
2578
|
*
|
|
2641
|
-
* Effect.gen(function*() {
|
|
2642
|
-
* const
|
|
2643
|
-
*
|
|
2644
|
-
*
|
|
2645
|
-
* const zoned = yield* DateTime.setZoneCurrent(now)
|
|
2646
|
-
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))
|
|
2579
|
+
* await Effect.runPromise(Effect.gen(function*() {
|
|
2580
|
+
* const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe("2024-01-01"))
|
|
2581
|
+
* return DateTime.zoneToString(zoned.zone)
|
|
2582
|
+
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))) // => "Europe/London"
|
|
2647
2583
|
* ```
|
|
2648
2584
|
*
|
|
2649
|
-
* @category
|
|
2585
|
+
* @category accessors
|
|
2650
2586
|
* @since 3.6.0
|
|
2651
2587
|
*/
|
|
2652
2588
|
export const setZoneCurrent = (self: DateTime): Effect.Effect<Zoned, never, CurrentTimeZone> =>
|
|
@@ -2657,17 +2593,18 @@ export const setZoneCurrent = (self: DateTime): Effect.Effect<Zoned, never, Curr
|
|
|
2657
2593
|
*
|
|
2658
2594
|
* **Example** (Providing the current time zone)
|
|
2659
2595
|
*
|
|
2660
|
-
* ```ts
|
|
2596
|
+
* ```ts import.meta.vitest
|
|
2661
2597
|
* import { DateTime, Effect } from "effect"
|
|
2662
2598
|
*
|
|
2663
2599
|
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
2664
2600
|
*
|
|
2665
|
-
* Effect.gen(function*() {
|
|
2666
|
-
* const
|
|
2667
|
-
*
|
|
2601
|
+
* await Effect.runPromise(Effect.gen(function*() {
|
|
2602
|
+
* const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe("2024-01-01"))
|
|
2603
|
+
* return DateTime.zoneToString(zoned.zone)
|
|
2604
|
+
* }).pipe(DateTime.withCurrentZone(zone))) // => "Europe/London"
|
|
2668
2605
|
* ```
|
|
2669
2606
|
*
|
|
2670
|
-
* @category
|
|
2607
|
+
* @category providing services
|
|
2671
2608
|
* @since 3.6.0
|
|
2672
2609
|
*/
|
|
2673
2610
|
export const withCurrentZone: {
|
|
@@ -2676,17 +2613,18 @@ export const withCurrentZone: {
|
|
|
2676
2613
|
*
|
|
2677
2614
|
* **Example** (Providing the current time zone)
|
|
2678
2615
|
*
|
|
2679
|
-
* ```ts
|
|
2616
|
+
* ```ts import.meta.vitest
|
|
2680
2617
|
* import { DateTime, Effect } from "effect"
|
|
2681
2618
|
*
|
|
2682
2619
|
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
2683
2620
|
*
|
|
2684
|
-
* Effect.gen(function*() {
|
|
2685
|
-
* const
|
|
2686
|
-
*
|
|
2621
|
+
* await Effect.runPromise(Effect.gen(function*() {
|
|
2622
|
+
* const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe("2024-01-01"))
|
|
2623
|
+
* return DateTime.zoneToString(zoned.zone)
|
|
2624
|
+
* }).pipe(DateTime.withCurrentZone(zone))) // => "Europe/London"
|
|
2687
2625
|
* ```
|
|
2688
2626
|
*
|
|
2689
|
-
* @category
|
|
2627
|
+
* @category providing services
|
|
2690
2628
|
* @since 3.6.0
|
|
2691
2629
|
*/
|
|
2692
2630
|
(value: TimeZone): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>
|
|
@@ -2695,17 +2633,18 @@ export const withCurrentZone: {
|
|
|
2695
2633
|
*
|
|
2696
2634
|
* **Example** (Providing the current time zone)
|
|
2697
2635
|
*
|
|
2698
|
-
* ```ts
|
|
2636
|
+
* ```ts import.meta.vitest
|
|
2699
2637
|
* import { DateTime, Effect } from "effect"
|
|
2700
2638
|
*
|
|
2701
2639
|
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
2702
2640
|
*
|
|
2703
|
-
* Effect.gen(function*() {
|
|
2704
|
-
* const
|
|
2705
|
-
*
|
|
2641
|
+
* await Effect.runPromise(Effect.gen(function*() {
|
|
2642
|
+
* const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe("2024-01-01"))
|
|
2643
|
+
* return DateTime.zoneToString(zoned.zone)
|
|
2644
|
+
* }).pipe(DateTime.withCurrentZone(zone))) // => "Europe/London"
|
|
2706
2645
|
* ```
|
|
2707
2646
|
*
|
|
2708
|
-
* @category
|
|
2647
|
+
* @category providing services
|
|
2709
2648
|
* @since 3.6.0
|
|
2710
2649
|
*/
|
|
2711
2650
|
<A, E, R>(self: Effect.Effect<A, E, R>, value: TimeZone): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>
|
|
@@ -2717,16 +2656,15 @@ export const withCurrentZone: {
|
|
|
2717
2656
|
*
|
|
2718
2657
|
* **Example** (Providing the local time zone)
|
|
2719
2658
|
*
|
|
2720
|
-
* ```ts
|
|
2659
|
+
* ```ts import.meta.vitest
|
|
2721
2660
|
* import { DateTime, Effect } from "effect"
|
|
2722
2661
|
*
|
|
2723
|
-
* Effect.gen(function*() {
|
|
2724
|
-
*
|
|
2725
|
-
*
|
|
2726
|
-
* }).pipe(DateTime.withCurrentZoneLocal)
|
|
2662
|
+
* await Effect.runPromise(Effect.gen(function*() {
|
|
2663
|
+
* return DateTime.isZoned(yield* DateTime.nowInCurrentZone)
|
|
2664
|
+
* }).pipe(DateTime.withCurrentZoneLocal)) // => true
|
|
2727
2665
|
* ```
|
|
2728
2666
|
*
|
|
2729
|
-
* @category
|
|
2667
|
+
* @category providing services
|
|
2730
2668
|
* @since 3.6.0
|
|
2731
2669
|
*/
|
|
2732
2670
|
export const withCurrentZoneLocal = <A, E, R>(
|
|
@@ -2739,16 +2677,17 @@ export const withCurrentZoneLocal = <A, E, R>(
|
|
|
2739
2677
|
*
|
|
2740
2678
|
* **Example** (Providing a fixed-offset time zone)
|
|
2741
2679
|
*
|
|
2742
|
-
* ```ts
|
|
2680
|
+
* ```ts import.meta.vitest
|
|
2743
2681
|
* import { DateTime, Effect } from "effect"
|
|
2744
2682
|
*
|
|
2745
|
-
* Effect.gen(function*() {
|
|
2746
|
-
*
|
|
2747
|
-
* console.log(DateTime.zoneToString(zone)) // "+03:00"
|
|
2683
|
+
* const program = Effect.gen(function*() {
|
|
2684
|
+
* return DateTime.zoneToString(yield* DateTime.CurrentTimeZone)
|
|
2748
2685
|
* }).pipe(DateTime.withCurrentZoneOffset(3 * 60 * 60 * 1000))
|
|
2686
|
+
*
|
|
2687
|
+
* await Effect.runPromise(program) // => "+03:00"
|
|
2749
2688
|
* ```
|
|
2750
2689
|
*
|
|
2751
|
-
* @category
|
|
2690
|
+
* @category providing services
|
|
2752
2691
|
* @since 3.6.0
|
|
2753
2692
|
*/
|
|
2754
2693
|
export const withCurrentZoneOffset: {
|
|
@@ -2757,16 +2696,17 @@ export const withCurrentZoneOffset: {
|
|
|
2757
2696
|
*
|
|
2758
2697
|
* **Example** (Providing a fixed-offset time zone)
|
|
2759
2698
|
*
|
|
2760
|
-
* ```ts
|
|
2699
|
+
* ```ts import.meta.vitest
|
|
2761
2700
|
* import { DateTime, Effect } from "effect"
|
|
2762
2701
|
*
|
|
2763
|
-
* Effect.gen(function*() {
|
|
2764
|
-
*
|
|
2765
|
-
* console.log(DateTime.zoneToString(zone)) // "+03:00"
|
|
2702
|
+
* const program = Effect.gen(function*() {
|
|
2703
|
+
* return DateTime.zoneToString(yield* DateTime.CurrentTimeZone)
|
|
2766
2704
|
* }).pipe(DateTime.withCurrentZoneOffset(3 * 60 * 60 * 1000))
|
|
2705
|
+
*
|
|
2706
|
+
* await Effect.runPromise(program) // => "+03:00"
|
|
2767
2707
|
* ```
|
|
2768
2708
|
*
|
|
2769
|
-
* @category
|
|
2709
|
+
* @category providing services
|
|
2770
2710
|
* @since 3.6.0
|
|
2771
2711
|
*/
|
|
2772
2712
|
(offset: number): <A, E, R>(
|
|
@@ -2777,16 +2717,17 @@ export const withCurrentZoneOffset: {
|
|
|
2777
2717
|
*
|
|
2778
2718
|
* **Example** (Providing a fixed-offset time zone)
|
|
2779
2719
|
*
|
|
2780
|
-
* ```ts
|
|
2720
|
+
* ```ts import.meta.vitest
|
|
2781
2721
|
* import { DateTime, Effect } from "effect"
|
|
2782
2722
|
*
|
|
2783
|
-
* Effect.gen(function*() {
|
|
2784
|
-
*
|
|
2785
|
-
* console.log(DateTime.zoneToString(zone)) // "+03:00"
|
|
2723
|
+
* const program = Effect.gen(function*() {
|
|
2724
|
+
* return DateTime.zoneToString(yield* DateTime.CurrentTimeZone)
|
|
2786
2725
|
* }).pipe(DateTime.withCurrentZoneOffset(3 * 60 * 60 * 1000))
|
|
2726
|
+
*
|
|
2727
|
+
* await Effect.runPromise(program) // => "+03:00"
|
|
2787
2728
|
* ```
|
|
2788
2729
|
*
|
|
2789
|
-
* @category
|
|
2730
|
+
* @category providing services
|
|
2790
2731
|
* @since 3.6.0
|
|
2791
2732
|
*/
|
|
2792
2733
|
<A, E, R>(effect: Effect.Effect<A, E, R>, offset: number): Effect.Effect<A, E, Exclude<R, CurrentTimeZone>>
|
|
@@ -2806,16 +2747,16 @@ export const withCurrentZoneOffset: {
|
|
|
2806
2747
|
*
|
|
2807
2748
|
* **Example** (Providing a named time zone)
|
|
2808
2749
|
*
|
|
2809
|
-
* ```ts
|
|
2750
|
+
* ```ts import.meta.vitest
|
|
2810
2751
|
* import { DateTime, Effect } from "effect"
|
|
2811
2752
|
*
|
|
2812
|
-
* Effect.gen(function*() {
|
|
2813
|
-
*
|
|
2814
|
-
*
|
|
2815
|
-
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))
|
|
2753
|
+
* await Effect.runPromise(Effect.gen(function*() {
|
|
2754
|
+
* const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe("2024-01-01"))
|
|
2755
|
+
* return DateTime.zoneToString(zoned.zone)
|
|
2756
|
+
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))) // => "Europe/London"
|
|
2816
2757
|
* ```
|
|
2817
2758
|
*
|
|
2818
|
-
* @category
|
|
2759
|
+
* @category providing services
|
|
2819
2760
|
* @since 3.6.0
|
|
2820
2761
|
*/
|
|
2821
2762
|
export const withCurrentZoneNamed: {
|
|
@@ -2829,16 +2770,16 @@ export const withCurrentZoneNamed: {
|
|
|
2829
2770
|
*
|
|
2830
2771
|
* **Example** (Providing a named time zone)
|
|
2831
2772
|
*
|
|
2832
|
-
* ```ts
|
|
2773
|
+
* ```ts import.meta.vitest
|
|
2833
2774
|
* import { DateTime, Effect } from "effect"
|
|
2834
2775
|
*
|
|
2835
|
-
* Effect.gen(function*() {
|
|
2836
|
-
*
|
|
2837
|
-
*
|
|
2838
|
-
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))
|
|
2776
|
+
* await Effect.runPromise(Effect.gen(function*() {
|
|
2777
|
+
* const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe("2024-01-01"))
|
|
2778
|
+
* return DateTime.zoneToString(zoned.zone)
|
|
2779
|
+
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))) // => "Europe/London"
|
|
2839
2780
|
* ```
|
|
2840
2781
|
*
|
|
2841
|
-
* @category
|
|
2782
|
+
* @category providing services
|
|
2842
2783
|
* @since 3.6.0
|
|
2843
2784
|
*/
|
|
2844
2785
|
(zone: string): <A, E, R>(
|
|
@@ -2854,16 +2795,16 @@ export const withCurrentZoneNamed: {
|
|
|
2854
2795
|
*
|
|
2855
2796
|
* **Example** (Providing a named time zone)
|
|
2856
2797
|
*
|
|
2857
|
-
* ```ts
|
|
2798
|
+
* ```ts import.meta.vitest
|
|
2858
2799
|
* import { DateTime, Effect } from "effect"
|
|
2859
2800
|
*
|
|
2860
|
-
* Effect.gen(function*() {
|
|
2861
|
-
*
|
|
2862
|
-
*
|
|
2863
|
-
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))
|
|
2801
|
+
* await Effect.runPromise(Effect.gen(function*() {
|
|
2802
|
+
* const zoned = yield* DateTime.setZoneCurrent(DateTime.makeUnsafe("2024-01-01"))
|
|
2803
|
+
* return DateTime.zoneToString(zoned.zone)
|
|
2804
|
+
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))) // => "Europe/London"
|
|
2864
2805
|
* ```
|
|
2865
2806
|
*
|
|
2866
|
-
* @category
|
|
2807
|
+
* @category providing services
|
|
2867
2808
|
* @since 3.6.0
|
|
2868
2809
|
*/
|
|
2869
2810
|
<A, E, R>(effect: Effect.Effect<A, E, R>, zone: string): Effect.Effect<A, E | IllegalArgumentError, Exclude<R, CurrentTimeZone>>
|
|
@@ -2881,16 +2822,15 @@ export const withCurrentZoneNamed: {
|
|
|
2881
2822
|
*
|
|
2882
2823
|
* **Example** (Getting the current time in the current zone)
|
|
2883
2824
|
*
|
|
2884
|
-
* ```ts
|
|
2825
|
+
* ```ts import.meta.vitest
|
|
2885
2826
|
* import { DateTime, Effect } from "effect"
|
|
2886
2827
|
*
|
|
2887
|
-
* Effect.gen(function*() {
|
|
2888
|
-
*
|
|
2889
|
-
*
|
|
2890
|
-
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))
|
|
2828
|
+
* await Effect.runPromise(Effect.gen(function*() {
|
|
2829
|
+
* return DateTime.zoneToString((yield* DateTime.nowInCurrentZone).zone)
|
|
2830
|
+
* }).pipe(DateTime.withCurrentZoneNamed("Europe/London"))) // => "Europe/London"
|
|
2891
2831
|
* ```
|
|
2892
2832
|
*
|
|
2893
|
-
* @category
|
|
2833
|
+
* @category accessors
|
|
2894
2834
|
* @since 3.6.0
|
|
2895
2835
|
*/
|
|
2896
2836
|
export const nowInCurrentZone: Effect.Effect<Zoned, never, CurrentTimeZone> = Effect.flatMap(now, setZoneCurrent)
|
|
@@ -2916,17 +2856,15 @@ export const nowInCurrentZone: Effect.Effect<Zoned, never, CurrentTimeZone> = Ef
|
|
|
2916
2856
|
*
|
|
2917
2857
|
* **Example** (Mutating DateTime values with Dates)
|
|
2918
2858
|
*
|
|
2919
|
-
* ```ts
|
|
2859
|
+
* ```ts import.meta.vitest
|
|
2920
2860
|
* import { DateTime } from "effect"
|
|
2921
2861
|
*
|
|
2922
2862
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
2923
2863
|
*
|
|
2924
|
-
*
|
|
2864
|
+
* DateTime.mutate(dt, (date) => {
|
|
2925
2865
|
* date.setHours(15) // Set to 3 PM
|
|
2926
2866
|
* date.setMinutes(30) // Set to 30 minutes
|
|
2927
2867
|
* })
|
|
2928
|
-
*
|
|
2929
|
-
* console.log(DateTime.formatIso(modified)) // "2024-01-01T15:30:00.000Z"
|
|
2930
2868
|
* ```
|
|
2931
2869
|
*
|
|
2932
2870
|
* @category mapping
|
|
@@ -2954,17 +2892,15 @@ export const mutate: {
|
|
|
2954
2892
|
*
|
|
2955
2893
|
* **Example** (Mutating DateTime values with Dates)
|
|
2956
2894
|
*
|
|
2957
|
-
* ```ts
|
|
2895
|
+
* ```ts import.meta.vitest
|
|
2958
2896
|
* import { DateTime } from "effect"
|
|
2959
2897
|
*
|
|
2960
2898
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
2961
2899
|
*
|
|
2962
|
-
*
|
|
2900
|
+
* DateTime.mutate(dt, (date) => {
|
|
2963
2901
|
* date.setHours(15) // Set to 3 PM
|
|
2964
2902
|
* date.setMinutes(30) // Set to 30 minutes
|
|
2965
2903
|
* })
|
|
2966
|
-
*
|
|
2967
|
-
* console.log(DateTime.formatIso(modified)) // "2024-01-01T15:30:00.000Z"
|
|
2968
2904
|
* ```
|
|
2969
2905
|
*
|
|
2970
2906
|
* @category mapping
|
|
@@ -2997,17 +2933,15 @@ export const mutate: {
|
|
|
2997
2933
|
*
|
|
2998
2934
|
* **Example** (Mutating DateTime values with Dates)
|
|
2999
2935
|
*
|
|
3000
|
-
* ```ts
|
|
2936
|
+
* ```ts import.meta.vitest
|
|
3001
2937
|
* import { DateTime } from "effect"
|
|
3002
2938
|
*
|
|
3003
2939
|
* const dt = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
3004
2940
|
*
|
|
3005
|
-
*
|
|
2941
|
+
* DateTime.mutate(dt, (date) => {
|
|
3006
2942
|
* date.setHours(15) // Set to 3 PM
|
|
3007
2943
|
* date.setMinutes(30) // Set to 30 minutes
|
|
3008
2944
|
* })
|
|
3009
|
-
*
|
|
3010
|
-
* console.log(DateTime.formatIso(modified)) // "2024-01-01T15:30:00.000Z"
|
|
3011
2945
|
* ```
|
|
3012
2946
|
*
|
|
3013
2947
|
* @category mapping
|
|
@@ -3032,7 +2966,7 @@ export const mutate: {
|
|
|
3032
2966
|
*
|
|
3033
2967
|
* **Example** (Mutating DateTime values with UTC Dates)
|
|
3034
2968
|
*
|
|
3035
|
-
* ```ts
|
|
2969
|
+
* ```ts import.meta.vitest
|
|
3036
2970
|
* import { DateTime } from "effect"
|
|
3037
2971
|
*
|
|
3038
2972
|
* const dt = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
|
|
@@ -3043,7 +2977,7 @@ export const mutate: {
|
|
|
3043
2977
|
* date.setUTCHours(18) // Set UTC time to 6 PM
|
|
3044
2978
|
* })
|
|
3045
2979
|
*
|
|
3046
|
-
*
|
|
2980
|
+
* modified // => DateTime.makeZonedUnsafe("2024-01-01T18:00:00Z", { timeZone: "Europe/London" })
|
|
3047
2981
|
* ```
|
|
3048
2982
|
*
|
|
3049
2983
|
* @category mapping
|
|
@@ -3060,7 +2994,7 @@ export const mutateUtc: {
|
|
|
3060
2994
|
*
|
|
3061
2995
|
* **Example** (Mutating DateTime values with UTC Dates)
|
|
3062
2996
|
*
|
|
3063
|
-
* ```ts
|
|
2997
|
+
* ```ts import.meta.vitest
|
|
3064
2998
|
* import { DateTime } from "effect"
|
|
3065
2999
|
*
|
|
3066
3000
|
* const dt = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
|
|
@@ -3071,7 +3005,7 @@ export const mutateUtc: {
|
|
|
3071
3005
|
* date.setUTCHours(18) // Set UTC time to 6 PM
|
|
3072
3006
|
* })
|
|
3073
3007
|
*
|
|
3074
|
-
*
|
|
3008
|
+
* modified // => DateTime.makeZonedUnsafe("2024-01-01T18:00:00Z", { timeZone: "Europe/London" })
|
|
3075
3009
|
* ```
|
|
3076
3010
|
*
|
|
3077
3011
|
* @category mapping
|
|
@@ -3088,7 +3022,7 @@ export const mutateUtc: {
|
|
|
3088
3022
|
*
|
|
3089
3023
|
* **Example** (Mutating DateTime values with UTC Dates)
|
|
3090
3024
|
*
|
|
3091
|
-
* ```ts
|
|
3025
|
+
* ```ts import.meta.vitest
|
|
3092
3026
|
* import { DateTime } from "effect"
|
|
3093
3027
|
*
|
|
3094
3028
|
* const dt = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
|
|
@@ -3099,7 +3033,7 @@ export const mutateUtc: {
|
|
|
3099
3033
|
* date.setUTCHours(18) // Set UTC time to 6 PM
|
|
3100
3034
|
* })
|
|
3101
3035
|
*
|
|
3102
|
-
*
|
|
3036
|
+
* modified // => DateTime.makeZonedUnsafe("2024-01-01T18:00:00Z", { timeZone: "Europe/London" })
|
|
3103
3037
|
* ```
|
|
3104
3038
|
*
|
|
3105
3039
|
* @category mapping
|
|
@@ -3114,13 +3048,14 @@ export const mutateUtc: {
|
|
|
3114
3048
|
*
|
|
3115
3049
|
* **Example** (Mapping epoch milliseconds)
|
|
3116
3050
|
*
|
|
3117
|
-
* ```ts
|
|
3051
|
+
* ```ts import.meta.vitest
|
|
3118
3052
|
* import { DateTime } from "effect"
|
|
3119
3053
|
*
|
|
3120
3054
|
* // add 10 milliseconds
|
|
3121
|
-
* DateTime.makeUnsafe(0).pipe(
|
|
3055
|
+
* const result = DateTime.makeUnsafe(0).pipe(
|
|
3122
3056
|
* DateTime.mapEpochMillis((millis) => millis + 10)
|
|
3123
3057
|
* )
|
|
3058
|
+
* result // => DateTime.makeUnsafe(10)
|
|
3124
3059
|
* ```
|
|
3125
3060
|
*
|
|
3126
3061
|
* @category mapping
|
|
@@ -3133,13 +3068,14 @@ export const mapEpochMillis: {
|
|
|
3133
3068
|
*
|
|
3134
3069
|
* **Example** (Mapping epoch milliseconds)
|
|
3135
3070
|
*
|
|
3136
|
-
* ```ts
|
|
3071
|
+
* ```ts import.meta.vitest
|
|
3137
3072
|
* import { DateTime } from "effect"
|
|
3138
3073
|
*
|
|
3139
3074
|
* // add 10 milliseconds
|
|
3140
|
-
* DateTime.makeUnsafe(0).pipe(
|
|
3075
|
+
* const result = DateTime.makeUnsafe(0).pipe(
|
|
3141
3076
|
* DateTime.mapEpochMillis((millis) => millis + 10)
|
|
3142
3077
|
* )
|
|
3078
|
+
* result // => DateTime.makeUnsafe(10)
|
|
3143
3079
|
* ```
|
|
3144
3080
|
*
|
|
3145
3081
|
* @category mapping
|
|
@@ -3152,13 +3088,14 @@ export const mapEpochMillis: {
|
|
|
3152
3088
|
*
|
|
3153
3089
|
* **Example** (Mapping epoch milliseconds)
|
|
3154
3090
|
*
|
|
3155
|
-
* ```ts
|
|
3091
|
+
* ```ts import.meta.vitest
|
|
3156
3092
|
* import { DateTime } from "effect"
|
|
3157
3093
|
*
|
|
3158
3094
|
* // add 10 milliseconds
|
|
3159
|
-
* DateTime.makeUnsafe(0).pipe(
|
|
3095
|
+
* const result = DateTime.makeUnsafe(0).pipe(
|
|
3160
3096
|
* DateTime.mapEpochMillis((millis) => millis + 10)
|
|
3161
3097
|
* )
|
|
3098
|
+
* result // => DateTime.makeUnsafe(10)
|
|
3162
3099
|
* ```
|
|
3163
3100
|
*
|
|
3164
3101
|
* @category mapping
|
|
@@ -3179,13 +3116,13 @@ export const mapEpochMillis: {
|
|
|
3179
3116
|
*
|
|
3180
3117
|
* **Example** (Applying time zone adjusted Dates)
|
|
3181
3118
|
*
|
|
3182
|
-
* ```ts
|
|
3119
|
+
* ```ts import.meta.vitest
|
|
3183
3120
|
* import { DateTime } from "effect"
|
|
3184
3121
|
*
|
|
3185
3122
|
* // get the time zone adjusted date in milliseconds
|
|
3186
3123
|
* DateTime.makeZonedUnsafe(0, { timeZone: "Europe/London" }).pipe(
|
|
3187
3124
|
* DateTime.withDate((date) => date.getTime())
|
|
3188
|
-
* )
|
|
3125
|
+
* ) // => 3600000
|
|
3189
3126
|
* ```
|
|
3190
3127
|
*
|
|
3191
3128
|
* @category mapping
|
|
@@ -3204,13 +3141,13 @@ export const withDate: {
|
|
|
3204
3141
|
*
|
|
3205
3142
|
* **Example** (Applying time zone adjusted Dates)
|
|
3206
3143
|
*
|
|
3207
|
-
* ```ts
|
|
3144
|
+
* ```ts import.meta.vitest
|
|
3208
3145
|
* import { DateTime } from "effect"
|
|
3209
3146
|
*
|
|
3210
3147
|
* // get the time zone adjusted date in milliseconds
|
|
3211
3148
|
* DateTime.makeZonedUnsafe(0, { timeZone: "Europe/London" }).pipe(
|
|
3212
3149
|
* DateTime.withDate((date) => date.getTime())
|
|
3213
|
-
* )
|
|
3150
|
+
* ) // => 3600000
|
|
3214
3151
|
* ```
|
|
3215
3152
|
*
|
|
3216
3153
|
* @category mapping
|
|
@@ -3229,13 +3166,13 @@ export const withDate: {
|
|
|
3229
3166
|
*
|
|
3230
3167
|
* **Example** (Applying time zone adjusted Dates)
|
|
3231
3168
|
*
|
|
3232
|
-
* ```ts
|
|
3169
|
+
* ```ts import.meta.vitest
|
|
3233
3170
|
* import { DateTime } from "effect"
|
|
3234
3171
|
*
|
|
3235
3172
|
* // get the time zone adjusted date in milliseconds
|
|
3236
3173
|
* DateTime.makeZonedUnsafe(0, { timeZone: "Europe/London" }).pipe(
|
|
3237
3174
|
* DateTime.withDate((date) => date.getTime())
|
|
3238
|
-
* )
|
|
3175
|
+
* ) // => 3600000
|
|
3239
3176
|
* ```
|
|
3240
3177
|
*
|
|
3241
3178
|
* @category mapping
|
|
@@ -3255,13 +3192,13 @@ export const withDate: {
|
|
|
3255
3192
|
*
|
|
3256
3193
|
* **Example** (Applying UTC Dates)
|
|
3257
3194
|
*
|
|
3258
|
-
* ```ts
|
|
3195
|
+
* ```ts import.meta.vitest
|
|
3259
3196
|
* import { DateTime } from "effect"
|
|
3260
3197
|
*
|
|
3261
3198
|
* // get the date in milliseconds
|
|
3262
3199
|
* DateTime.makeUnsafe(0).pipe(
|
|
3263
3200
|
* DateTime.withDateUtc((date) => date.getTime())
|
|
3264
|
-
* )
|
|
3201
|
+
* ) // => 0
|
|
3265
3202
|
* ```
|
|
3266
3203
|
*
|
|
3267
3204
|
* @category mapping
|
|
@@ -3279,13 +3216,13 @@ export const withDateUtc: {
|
|
|
3279
3216
|
*
|
|
3280
3217
|
* **Example** (Applying UTC Dates)
|
|
3281
3218
|
*
|
|
3282
|
-
* ```ts
|
|
3219
|
+
* ```ts import.meta.vitest
|
|
3283
3220
|
* import { DateTime } from "effect"
|
|
3284
3221
|
*
|
|
3285
3222
|
* // get the date in milliseconds
|
|
3286
3223
|
* DateTime.makeUnsafe(0).pipe(
|
|
3287
3224
|
* DateTime.withDateUtc((date) => date.getTime())
|
|
3288
|
-
* )
|
|
3225
|
+
* ) // => 0
|
|
3289
3226
|
* ```
|
|
3290
3227
|
*
|
|
3291
3228
|
* @category mapping
|
|
@@ -3303,13 +3240,13 @@ export const withDateUtc: {
|
|
|
3303
3240
|
*
|
|
3304
3241
|
* **Example** (Applying UTC Dates)
|
|
3305
3242
|
*
|
|
3306
|
-
* ```ts
|
|
3243
|
+
* ```ts import.meta.vitest
|
|
3307
3244
|
* import { DateTime } from "effect"
|
|
3308
3245
|
*
|
|
3309
3246
|
* // get the date in milliseconds
|
|
3310
3247
|
* DateTime.makeUnsafe(0).pipe(
|
|
3311
3248
|
* DateTime.withDateUtc((date) => date.getTime())
|
|
3312
|
-
* )
|
|
3249
|
+
* ) // => 0
|
|
3313
3250
|
* ```
|
|
3314
3251
|
*
|
|
3315
3252
|
* @category mapping
|
|
@@ -3323,7 +3260,7 @@ export const withDateUtc: {
|
|
|
3323
3260
|
*
|
|
3324
3261
|
* **Example** (Pattern matching DateTime variants)
|
|
3325
3262
|
*
|
|
3326
|
-
* ```ts
|
|
3263
|
+
* ```ts import.meta.vitest
|
|
3327
3264
|
* import { DateTime } from "effect"
|
|
3328
3265
|
*
|
|
3329
3266
|
* const dt1 = DateTime.makeUnsafe("2024-01-01T12:00:00Z") // Utc
|
|
@@ -3341,8 +3278,8 @@ export const withDateUtc: {
|
|
|
3341
3278
|
* onZoned: (zoned) => `Zoned: ${DateTime.formatIsoZoned(zoned)}`
|
|
3342
3279
|
* })
|
|
3343
3280
|
*
|
|
3344
|
-
*
|
|
3345
|
-
*
|
|
3281
|
+
* result1 // => "UTC: 2024-01-01T12:00:00.000Z"
|
|
3282
|
+
* result2 // => "Zoned: 2024-06-15T15:30:00.000+01:00[Europe/London]"
|
|
3346
3283
|
* ```
|
|
3347
3284
|
*
|
|
3348
3285
|
* @category mapping
|
|
@@ -3354,7 +3291,7 @@ export const match: {
|
|
|
3354
3291
|
*
|
|
3355
3292
|
* **Example** (Pattern matching DateTime variants)
|
|
3356
3293
|
*
|
|
3357
|
-
* ```ts
|
|
3294
|
+
* ```ts import.meta.vitest
|
|
3358
3295
|
* import { DateTime } from "effect"
|
|
3359
3296
|
*
|
|
3360
3297
|
* const dt1 = DateTime.makeUnsafe("2024-01-01T12:00:00Z") // Utc
|
|
@@ -3372,8 +3309,8 @@ export const match: {
|
|
|
3372
3309
|
* onZoned: (zoned) => `Zoned: ${DateTime.formatIsoZoned(zoned)}`
|
|
3373
3310
|
* })
|
|
3374
3311
|
*
|
|
3375
|
-
*
|
|
3376
|
-
*
|
|
3312
|
+
* result1 // => "UTC: 2024-01-01T12:00:00.000Z"
|
|
3313
|
+
* result2 // => "Zoned: 2024-06-15T15:30:00.000+01:00[Europe/London]"
|
|
3377
3314
|
* ```
|
|
3378
3315
|
*
|
|
3379
3316
|
* @category mapping
|
|
@@ -3390,7 +3327,7 @@ export const match: {
|
|
|
3390
3327
|
*
|
|
3391
3328
|
* **Example** (Pattern matching DateTime variants)
|
|
3392
3329
|
*
|
|
3393
|
-
* ```ts
|
|
3330
|
+
* ```ts import.meta.vitest
|
|
3394
3331
|
* import { DateTime } from "effect"
|
|
3395
3332
|
*
|
|
3396
3333
|
* const dt1 = DateTime.makeUnsafe("2024-01-01T12:00:00Z") // Utc
|
|
@@ -3408,8 +3345,8 @@ export const match: {
|
|
|
3408
3345
|
* onZoned: (zoned) => `Zoned: ${DateTime.formatIsoZoned(zoned)}`
|
|
3409
3346
|
* })
|
|
3410
3347
|
*
|
|
3411
|
-
*
|
|
3412
|
-
*
|
|
3348
|
+
* result1 // => "UTC: 2024-01-01T12:00:00.000Z"
|
|
3349
|
+
* result2 // => "Zoned: 2024-06-15T15:30:00.000+01:00[Europe/London]"
|
|
3413
3350
|
* ```
|
|
3414
3351
|
*
|
|
3415
3352
|
* @category mapping
|
|
@@ -3449,13 +3386,13 @@ export const match: {
|
|
|
3449
3386
|
*
|
|
3450
3387
|
* **Example** (Adding durations)
|
|
3451
3388
|
*
|
|
3452
|
-
* ```ts
|
|
3389
|
+
* ```ts import.meta.vitest
|
|
3453
3390
|
* import { DateTime } from "effect"
|
|
3454
3391
|
*
|
|
3455
3392
|
* // add 5 minutes
|
|
3456
3393
|
* DateTime.makeUnsafe(0).pipe(
|
|
3457
3394
|
* DateTime.addDuration("5 minutes")
|
|
3458
|
-
* )
|
|
3395
|
+
* ) // => DateTime.makeUnsafe(300000)
|
|
3459
3396
|
* ```
|
|
3460
3397
|
*
|
|
3461
3398
|
* @see {@link add} for calendar-aware date/time part arithmetic
|
|
@@ -3490,13 +3427,13 @@ export const addDuration: {
|
|
|
3490
3427
|
*
|
|
3491
3428
|
* **Example** (Adding durations)
|
|
3492
3429
|
*
|
|
3493
|
-
* ```ts
|
|
3430
|
+
* ```ts import.meta.vitest
|
|
3494
3431
|
* import { DateTime } from "effect"
|
|
3495
3432
|
*
|
|
3496
3433
|
* // add 5 minutes
|
|
3497
3434
|
* DateTime.makeUnsafe(0).pipe(
|
|
3498
3435
|
* DateTime.addDuration("5 minutes")
|
|
3499
|
-
* )
|
|
3436
|
+
* ) // => DateTime.makeUnsafe(300000)
|
|
3500
3437
|
* ```
|
|
3501
3438
|
*
|
|
3502
3439
|
* @see {@link add} for calendar-aware date/time part arithmetic
|
|
@@ -3531,13 +3468,13 @@ export const addDuration: {
|
|
|
3531
3468
|
*
|
|
3532
3469
|
* **Example** (Adding durations)
|
|
3533
3470
|
*
|
|
3534
|
-
* ```ts
|
|
3471
|
+
* ```ts import.meta.vitest
|
|
3535
3472
|
* import { DateTime } from "effect"
|
|
3536
3473
|
*
|
|
3537
3474
|
* // add 5 minutes
|
|
3538
3475
|
* DateTime.makeUnsafe(0).pipe(
|
|
3539
3476
|
* DateTime.addDuration("5 minutes")
|
|
3540
|
-
* )
|
|
3477
|
+
* ) // => DateTime.makeUnsafe(300000)
|
|
3541
3478
|
* ```
|
|
3542
3479
|
*
|
|
3543
3480
|
* @see {@link add} for calendar-aware date/time part arithmetic
|
|
@@ -3554,13 +3491,13 @@ export const addDuration: {
|
|
|
3554
3491
|
*
|
|
3555
3492
|
* **Example** (Subtracting durations)
|
|
3556
3493
|
*
|
|
3557
|
-
* ```ts
|
|
3494
|
+
* ```ts import.meta.vitest
|
|
3558
3495
|
* import { DateTime } from "effect"
|
|
3559
3496
|
*
|
|
3560
3497
|
* // subtract 5 minutes
|
|
3561
3498
|
* DateTime.makeUnsafe(0).pipe(
|
|
3562
3499
|
* DateTime.subtractDuration("5 minutes")
|
|
3563
|
-
* )
|
|
3500
|
+
* ) // => DateTime.makeUnsafe(-300000)
|
|
3564
3501
|
* ```
|
|
3565
3502
|
*
|
|
3566
3503
|
* @category math
|
|
@@ -3572,13 +3509,13 @@ export const subtractDuration: {
|
|
|
3572
3509
|
*
|
|
3573
3510
|
* **Example** (Subtracting durations)
|
|
3574
3511
|
*
|
|
3575
|
-
* ```ts
|
|
3512
|
+
* ```ts import.meta.vitest
|
|
3576
3513
|
* import { DateTime } from "effect"
|
|
3577
3514
|
*
|
|
3578
3515
|
* // subtract 5 minutes
|
|
3579
3516
|
* DateTime.makeUnsafe(0).pipe(
|
|
3580
3517
|
* DateTime.subtractDuration("5 minutes")
|
|
3581
|
-
* )
|
|
3518
|
+
* ) // => DateTime.makeUnsafe(-300000)
|
|
3582
3519
|
* ```
|
|
3583
3520
|
*
|
|
3584
3521
|
* @category math
|
|
@@ -3590,13 +3527,13 @@ export const subtractDuration: {
|
|
|
3590
3527
|
*
|
|
3591
3528
|
* **Example** (Subtracting durations)
|
|
3592
3529
|
*
|
|
3593
|
-
* ```ts
|
|
3530
|
+
* ```ts import.meta.vitest
|
|
3594
3531
|
* import { DateTime } from "effect"
|
|
3595
3532
|
*
|
|
3596
3533
|
* // subtract 5 minutes
|
|
3597
3534
|
* DateTime.makeUnsafe(0).pipe(
|
|
3598
3535
|
* DateTime.subtractDuration("5 minutes")
|
|
3599
|
-
* )
|
|
3536
|
+
* ) // => DateTime.makeUnsafe(-300000)
|
|
3600
3537
|
* ```
|
|
3601
3538
|
*
|
|
3602
3539
|
* @category math
|
|
@@ -3615,13 +3552,13 @@ export const subtractDuration: {
|
|
|
3615
3552
|
*
|
|
3616
3553
|
* **Example** (Adding date and time parts)
|
|
3617
3554
|
*
|
|
3618
|
-
* ```ts
|
|
3555
|
+
* ```ts import.meta.vitest
|
|
3619
3556
|
* import { DateTime } from "effect"
|
|
3620
3557
|
*
|
|
3621
3558
|
* // add 5 minutes
|
|
3622
3559
|
* DateTime.makeUnsafe(0).pipe(
|
|
3623
3560
|
* DateTime.add({ minutes: 5 })
|
|
3624
|
-
* )
|
|
3561
|
+
* ) // => DateTime.makeUnsafe(300000)
|
|
3625
3562
|
* ```
|
|
3626
3563
|
*
|
|
3627
3564
|
* @category math
|
|
@@ -3638,13 +3575,13 @@ export const add: {
|
|
|
3638
3575
|
*
|
|
3639
3576
|
* **Example** (Adding date and time parts)
|
|
3640
3577
|
*
|
|
3641
|
-
* ```ts
|
|
3578
|
+
* ```ts import.meta.vitest
|
|
3642
3579
|
* import { DateTime } from "effect"
|
|
3643
3580
|
*
|
|
3644
3581
|
* // add 5 minutes
|
|
3645
3582
|
* DateTime.makeUnsafe(0).pipe(
|
|
3646
3583
|
* DateTime.add({ minutes: 5 })
|
|
3647
|
-
* )
|
|
3584
|
+
* ) // => DateTime.makeUnsafe(300000)
|
|
3648
3585
|
* ```
|
|
3649
3586
|
*
|
|
3650
3587
|
* @category math
|
|
@@ -3661,13 +3598,13 @@ export const add: {
|
|
|
3661
3598
|
*
|
|
3662
3599
|
* **Example** (Adding date and time parts)
|
|
3663
3600
|
*
|
|
3664
|
-
* ```ts
|
|
3601
|
+
* ```ts import.meta.vitest
|
|
3665
3602
|
* import { DateTime } from "effect"
|
|
3666
3603
|
*
|
|
3667
3604
|
* // add 5 minutes
|
|
3668
3605
|
* DateTime.makeUnsafe(0).pipe(
|
|
3669
3606
|
* DateTime.add({ minutes: 5 })
|
|
3670
|
-
* )
|
|
3607
|
+
* ) // => DateTime.makeUnsafe(300000)
|
|
3671
3608
|
* ```
|
|
3672
3609
|
*
|
|
3673
3610
|
* @category math
|
|
@@ -3681,13 +3618,13 @@ export const add: {
|
|
|
3681
3618
|
*
|
|
3682
3619
|
* **Example** (Subtracting date and time parts)
|
|
3683
3620
|
*
|
|
3684
|
-
* ```ts
|
|
3621
|
+
* ```ts import.meta.vitest
|
|
3685
3622
|
* import { DateTime } from "effect"
|
|
3686
3623
|
*
|
|
3687
3624
|
* // subtract 5 minutes
|
|
3688
3625
|
* DateTime.makeUnsafe(0).pipe(
|
|
3689
3626
|
* DateTime.subtract({ minutes: 5 })
|
|
3690
|
-
* )
|
|
3627
|
+
* ) // => DateTime.makeUnsafe(-300000)
|
|
3691
3628
|
* ```
|
|
3692
3629
|
*
|
|
3693
3630
|
* @category math
|
|
@@ -3699,13 +3636,13 @@ export const subtract: {
|
|
|
3699
3636
|
*
|
|
3700
3637
|
* **Example** (Subtracting date and time parts)
|
|
3701
3638
|
*
|
|
3702
|
-
* ```ts
|
|
3639
|
+
* ```ts import.meta.vitest
|
|
3703
3640
|
* import { DateTime } from "effect"
|
|
3704
3641
|
*
|
|
3705
3642
|
* // subtract 5 minutes
|
|
3706
3643
|
* DateTime.makeUnsafe(0).pipe(
|
|
3707
3644
|
* DateTime.subtract({ minutes: 5 })
|
|
3708
|
-
* )
|
|
3645
|
+
* ) // => DateTime.makeUnsafe(-300000)
|
|
3709
3646
|
* ```
|
|
3710
3647
|
*
|
|
3711
3648
|
* @category math
|
|
@@ -3717,13 +3654,13 @@ export const subtract: {
|
|
|
3717
3654
|
*
|
|
3718
3655
|
* **Example** (Subtracting date and time parts)
|
|
3719
3656
|
*
|
|
3720
|
-
* ```ts
|
|
3657
|
+
* ```ts import.meta.vitest
|
|
3721
3658
|
* import { DateTime } from "effect"
|
|
3722
3659
|
*
|
|
3723
3660
|
* // subtract 5 minutes
|
|
3724
3661
|
* DateTime.makeUnsafe(0).pipe(
|
|
3725
3662
|
* DateTime.subtract({ minutes: 5 })
|
|
3726
|
-
* )
|
|
3663
|
+
* ) // => DateTime.makeUnsafe(-300000)
|
|
3727
3664
|
* ```
|
|
3728
3665
|
*
|
|
3729
3666
|
* @category math
|
|
@@ -3742,14 +3679,13 @@ export const subtract: {
|
|
|
3742
3679
|
*
|
|
3743
3680
|
* **Example** (Rounding down DateTime values)
|
|
3744
3681
|
*
|
|
3745
|
-
* ```ts
|
|
3682
|
+
* ```ts import.meta.vitest
|
|
3746
3683
|
* import { DateTime } from "effect"
|
|
3747
3684
|
*
|
|
3748
3685
|
* // returns "2024-01-01T00:00:00Z"
|
|
3749
3686
|
* DateTime.makeUnsafe("2024-01-01T12:00:00Z").pipe(
|
|
3750
3687
|
* DateTime.startOf("day"),
|
|
3751
|
-
*
|
|
3752
|
-
* )
|
|
3688
|
+
* ) // => DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
3753
3689
|
* ```
|
|
3754
3690
|
*
|
|
3755
3691
|
* @category math
|
|
@@ -3766,14 +3702,13 @@ export const startOf: {
|
|
|
3766
3702
|
*
|
|
3767
3703
|
* **Example** (Rounding down DateTime values)
|
|
3768
3704
|
*
|
|
3769
|
-
* ```ts
|
|
3705
|
+
* ```ts import.meta.vitest
|
|
3770
3706
|
* import { DateTime } from "effect"
|
|
3771
3707
|
*
|
|
3772
3708
|
* // returns "2024-01-01T00:00:00Z"
|
|
3773
3709
|
* DateTime.makeUnsafe("2024-01-01T12:00:00Z").pipe(
|
|
3774
3710
|
* DateTime.startOf("day"),
|
|
3775
|
-
*
|
|
3776
|
-
* )
|
|
3711
|
+
* ) // => DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
3777
3712
|
* ```
|
|
3778
3713
|
*
|
|
3779
3714
|
* @category math
|
|
@@ -3793,14 +3728,13 @@ export const startOf: {
|
|
|
3793
3728
|
*
|
|
3794
3729
|
* **Example** (Rounding down DateTime values)
|
|
3795
3730
|
*
|
|
3796
|
-
* ```ts
|
|
3731
|
+
* ```ts import.meta.vitest
|
|
3797
3732
|
* import { DateTime } from "effect"
|
|
3798
3733
|
*
|
|
3799
3734
|
* // returns "2024-01-01T00:00:00Z"
|
|
3800
3735
|
* DateTime.makeUnsafe("2024-01-01T12:00:00Z").pipe(
|
|
3801
3736
|
* DateTime.startOf("day"),
|
|
3802
|
-
*
|
|
3803
|
-
* )
|
|
3737
|
+
* ) // => DateTime.makeUnsafe("2024-01-01T00:00:00Z")
|
|
3804
3738
|
* ```
|
|
3805
3739
|
*
|
|
3806
3740
|
* @category math
|
|
@@ -3823,14 +3757,13 @@ export const startOf: {
|
|
|
3823
3757
|
*
|
|
3824
3758
|
* **Example** (Rounding up DateTime values)
|
|
3825
3759
|
*
|
|
3826
|
-
* ```ts
|
|
3760
|
+
* ```ts import.meta.vitest
|
|
3827
3761
|
* import { DateTime } from "effect"
|
|
3828
3762
|
*
|
|
3829
3763
|
* // returns "2024-01-01T23:59:59.999Z"
|
|
3830
3764
|
* DateTime.makeUnsafe("2024-01-01T12:00:00Z").pipe(
|
|
3831
3765
|
* DateTime.endOf("day"),
|
|
3832
|
-
*
|
|
3833
|
-
* )
|
|
3766
|
+
* ) // => DateTime.makeUnsafe("2024-01-01T23:59:59.999Z")
|
|
3834
3767
|
* ```
|
|
3835
3768
|
*
|
|
3836
3769
|
* @category math
|
|
@@ -3847,14 +3780,13 @@ export const endOf: {
|
|
|
3847
3780
|
*
|
|
3848
3781
|
* **Example** (Rounding up DateTime values)
|
|
3849
3782
|
*
|
|
3850
|
-
* ```ts
|
|
3783
|
+
* ```ts import.meta.vitest
|
|
3851
3784
|
* import { DateTime } from "effect"
|
|
3852
3785
|
*
|
|
3853
3786
|
* // returns "2024-01-01T23:59:59.999Z"
|
|
3854
3787
|
* DateTime.makeUnsafe("2024-01-01T12:00:00Z").pipe(
|
|
3855
3788
|
* DateTime.endOf("day"),
|
|
3856
|
-
*
|
|
3857
|
-
* )
|
|
3789
|
+
* ) // => DateTime.makeUnsafe("2024-01-01T23:59:59.999Z")
|
|
3858
3790
|
* ```
|
|
3859
3791
|
*
|
|
3860
3792
|
* @category math
|
|
@@ -3874,14 +3806,13 @@ export const endOf: {
|
|
|
3874
3806
|
*
|
|
3875
3807
|
* **Example** (Rounding up DateTime values)
|
|
3876
3808
|
*
|
|
3877
|
-
* ```ts
|
|
3809
|
+
* ```ts import.meta.vitest
|
|
3878
3810
|
* import { DateTime } from "effect"
|
|
3879
3811
|
*
|
|
3880
3812
|
* // returns "2024-01-01T23:59:59.999Z"
|
|
3881
3813
|
* DateTime.makeUnsafe("2024-01-01T12:00:00Z").pipe(
|
|
3882
3814
|
* DateTime.endOf("day"),
|
|
3883
|
-
*
|
|
3884
|
-
* )
|
|
3815
|
+
* ) // => DateTime.makeUnsafe("2024-01-01T23:59:59.999Z")
|
|
3885
3816
|
* ```
|
|
3886
3817
|
*
|
|
3887
3818
|
* @category math
|
|
@@ -3904,14 +3835,13 @@ export const endOf: {
|
|
|
3904
3835
|
*
|
|
3905
3836
|
* **Example** (Rounding DateTime values to nearest units)
|
|
3906
3837
|
*
|
|
3907
|
-
* ```ts
|
|
3838
|
+
* ```ts import.meta.vitest
|
|
3908
3839
|
* import { DateTime } from "effect"
|
|
3909
3840
|
*
|
|
3910
3841
|
* // returns "2024-01-02T00:00:00Z"
|
|
3911
3842
|
* DateTime.makeUnsafe("2024-01-01T12:01:00Z").pipe(
|
|
3912
3843
|
* DateTime.nearest("day"),
|
|
3913
|
-
*
|
|
3914
|
-
* )
|
|
3844
|
+
* ) // => DateTime.makeUnsafe("2024-01-02T00:00:00Z")
|
|
3915
3845
|
* ```
|
|
3916
3846
|
*
|
|
3917
3847
|
* @category math
|
|
@@ -3928,14 +3858,13 @@ export const nearest: {
|
|
|
3928
3858
|
*
|
|
3929
3859
|
* **Example** (Rounding DateTime values to nearest units)
|
|
3930
3860
|
*
|
|
3931
|
-
* ```ts
|
|
3861
|
+
* ```ts import.meta.vitest
|
|
3932
3862
|
* import { DateTime } from "effect"
|
|
3933
3863
|
*
|
|
3934
3864
|
* // returns "2024-01-02T00:00:00Z"
|
|
3935
3865
|
* DateTime.makeUnsafe("2024-01-01T12:01:00Z").pipe(
|
|
3936
3866
|
* DateTime.nearest("day"),
|
|
3937
|
-
*
|
|
3938
|
-
* )
|
|
3867
|
+
* ) // => DateTime.makeUnsafe("2024-01-02T00:00:00Z")
|
|
3939
3868
|
* ```
|
|
3940
3869
|
*
|
|
3941
3870
|
* @category math
|
|
@@ -3955,14 +3884,13 @@ export const nearest: {
|
|
|
3955
3884
|
*
|
|
3956
3885
|
* **Example** (Rounding DateTime values to nearest units)
|
|
3957
3886
|
*
|
|
3958
|
-
* ```ts
|
|
3887
|
+
* ```ts import.meta.vitest
|
|
3959
3888
|
* import { DateTime } from "effect"
|
|
3960
3889
|
*
|
|
3961
3890
|
* // returns "2024-01-02T00:00:00Z"
|
|
3962
3891
|
* DateTime.makeUnsafe("2024-01-01T12:01:00Z").pipe(
|
|
3963
3892
|
* DateTime.nearest("day"),
|
|
3964
|
-
*
|
|
3965
|
-
* )
|
|
3893
|
+
* ) // => DateTime.makeUnsafe("2024-01-02T00:00:00Z")
|
|
3966
3894
|
* ```
|
|
3967
3895
|
*
|
|
3968
3896
|
* @category math
|
|
@@ -3993,20 +3921,18 @@ export const nearest: {
|
|
|
3993
3921
|
*
|
|
3994
3922
|
* **Example** (Formatting DateTime values with Intl options)
|
|
3995
3923
|
*
|
|
3996
|
-
* ```ts
|
|
3924
|
+
* ```ts import.meta.vitest
|
|
3997
3925
|
* import { DateTime } from "effect"
|
|
3998
3926
|
*
|
|
3999
3927
|
* const dt = DateTime.makeZonedUnsafe("2024-06-15T14:30:00Z", {
|
|
4000
3928
|
* timeZone: "Europe/London"
|
|
4001
3929
|
* })
|
|
4002
3930
|
*
|
|
4003
|
-
*
|
|
3931
|
+
* DateTime.format(dt, {
|
|
4004
3932
|
* dateStyle: "full",
|
|
4005
3933
|
* timeStyle: "short",
|
|
4006
3934
|
* locale: "en-US"
|
|
4007
|
-
* })
|
|
4008
|
-
*
|
|
4009
|
-
* console.log(formatted) // "Saturday, June 15, 2024 at 3:30 PM"
|
|
3935
|
+
* }) // => "Saturday, June 15, 2024 at 3:30 PM"
|
|
4010
3936
|
* ```
|
|
4011
3937
|
*
|
|
4012
3938
|
* @category formatting
|
|
@@ -4031,20 +3957,18 @@ export const format: {
|
|
|
4031
3957
|
*
|
|
4032
3958
|
* **Example** (Formatting DateTime values with Intl options)
|
|
4033
3959
|
*
|
|
4034
|
-
* ```ts
|
|
3960
|
+
* ```ts import.meta.vitest
|
|
4035
3961
|
* import { DateTime } from "effect"
|
|
4036
3962
|
*
|
|
4037
3963
|
* const dt = DateTime.makeZonedUnsafe("2024-06-15T14:30:00Z", {
|
|
4038
3964
|
* timeZone: "Europe/London"
|
|
4039
3965
|
* })
|
|
4040
3966
|
*
|
|
4041
|
-
*
|
|
3967
|
+
* DateTime.format(dt, {
|
|
4042
3968
|
* dateStyle: "full",
|
|
4043
3969
|
* timeStyle: "short",
|
|
4044
3970
|
* locale: "en-US"
|
|
4045
|
-
* })
|
|
4046
|
-
*
|
|
4047
|
-
* console.log(formatted) // "Saturday, June 15, 2024 at 3:30 PM"
|
|
3971
|
+
* }) // => "Saturday, June 15, 2024 at 3:30 PM"
|
|
4048
3972
|
* ```
|
|
4049
3973
|
*
|
|
4050
3974
|
* @category formatting
|
|
@@ -4075,20 +3999,18 @@ export const format: {
|
|
|
4075
3999
|
*
|
|
4076
4000
|
* **Example** (Formatting DateTime values with Intl options)
|
|
4077
4001
|
*
|
|
4078
|
-
* ```ts
|
|
4002
|
+
* ```ts import.meta.vitest
|
|
4079
4003
|
* import { DateTime } from "effect"
|
|
4080
4004
|
*
|
|
4081
4005
|
* const dt = DateTime.makeZonedUnsafe("2024-06-15T14:30:00Z", {
|
|
4082
4006
|
* timeZone: "Europe/London"
|
|
4083
4007
|
* })
|
|
4084
4008
|
*
|
|
4085
|
-
*
|
|
4009
|
+
* DateTime.format(dt, {
|
|
4086
4010
|
* dateStyle: "full",
|
|
4087
4011
|
* timeStyle: "short",
|
|
4088
4012
|
* locale: "en-US"
|
|
4089
|
-
* })
|
|
4090
|
-
*
|
|
4091
|
-
* console.log(formatted) // "Saturday, June 15, 2024 at 3:30 PM"
|
|
4013
|
+
* }) // => "Saturday, June 15, 2024 at 3:30 PM"
|
|
4092
4014
|
* ```
|
|
4093
4015
|
*
|
|
4094
4016
|
* @category formatting
|
|
@@ -4110,21 +4032,19 @@ export const format: {
|
|
|
4110
4032
|
*
|
|
4111
4033
|
* **Example** (Formatting DateTime values locally)
|
|
4112
4034
|
*
|
|
4113
|
-
* ```ts
|
|
4035
|
+
* ```ts import.meta.vitest
|
|
4114
4036
|
* import { DateTime } from "effect"
|
|
4115
4037
|
*
|
|
4116
4038
|
* const dt = DateTime.makeUnsafe("2024-06-15T14:30:00Z")
|
|
4117
4039
|
*
|
|
4118
4040
|
* // Uses system local time zone and locale
|
|
4119
|
-
*
|
|
4041
|
+
* DateTime.formatLocal(dt, {
|
|
4120
4042
|
* year: "numeric",
|
|
4121
4043
|
* month: "long",
|
|
4122
4044
|
* day: "numeric",
|
|
4123
4045
|
* hour: "2-digit",
|
|
4124
4046
|
* minute: "2-digit"
|
|
4125
4047
|
* })
|
|
4126
|
-
*
|
|
4127
|
-
* console.log(local) // Output depends on system locale/timezone
|
|
4128
4048
|
* ```
|
|
4129
4049
|
*
|
|
4130
4050
|
* @category formatting
|
|
@@ -4137,21 +4057,19 @@ export const formatLocal: {
|
|
|
4137
4057
|
*
|
|
4138
4058
|
* **Example** (Formatting DateTime values locally)
|
|
4139
4059
|
*
|
|
4140
|
-
* ```ts
|
|
4060
|
+
* ```ts import.meta.vitest
|
|
4141
4061
|
* import { DateTime } from "effect"
|
|
4142
4062
|
*
|
|
4143
4063
|
* const dt = DateTime.makeUnsafe("2024-06-15T14:30:00Z")
|
|
4144
4064
|
*
|
|
4145
4065
|
* // Uses system local time zone and locale
|
|
4146
|
-
*
|
|
4066
|
+
* DateTime.formatLocal(dt, {
|
|
4147
4067
|
* year: "numeric",
|
|
4148
4068
|
* month: "long",
|
|
4149
4069
|
* day: "numeric",
|
|
4150
4070
|
* hour: "2-digit",
|
|
4151
4071
|
* minute: "2-digit"
|
|
4152
4072
|
* })
|
|
4153
|
-
*
|
|
4154
|
-
* console.log(local) // Output depends on system locale/timezone
|
|
4155
4073
|
* ```
|
|
4156
4074
|
*
|
|
4157
4075
|
* @category formatting
|
|
@@ -4170,21 +4088,19 @@ export const formatLocal: {
|
|
|
4170
4088
|
*
|
|
4171
4089
|
* **Example** (Formatting DateTime values locally)
|
|
4172
4090
|
*
|
|
4173
|
-
* ```ts
|
|
4091
|
+
* ```ts import.meta.vitest
|
|
4174
4092
|
* import { DateTime } from "effect"
|
|
4175
4093
|
*
|
|
4176
4094
|
* const dt = DateTime.makeUnsafe("2024-06-15T14:30:00Z")
|
|
4177
4095
|
*
|
|
4178
4096
|
* // Uses system local time zone and locale
|
|
4179
|
-
*
|
|
4097
|
+
* DateTime.formatLocal(dt, {
|
|
4180
4098
|
* year: "numeric",
|
|
4181
4099
|
* month: "long",
|
|
4182
4100
|
* day: "numeric",
|
|
4183
4101
|
* hour: "2-digit",
|
|
4184
4102
|
* minute: "2-digit"
|
|
4185
4103
|
* })
|
|
4186
|
-
*
|
|
4187
|
-
* console.log(local) // Output depends on system locale/timezone
|
|
4188
4104
|
* ```
|
|
4189
4105
|
*
|
|
4190
4106
|
* @category formatting
|
|
@@ -4209,7 +4125,7 @@ export const formatLocal: {
|
|
|
4209
4125
|
*
|
|
4210
4126
|
* **Example** (Formatting DateTime values in UTC)
|
|
4211
4127
|
*
|
|
4212
|
-
* ```ts
|
|
4128
|
+
* ```ts import.meta.vitest
|
|
4213
4129
|
* import { DateTime } from "effect"
|
|
4214
4130
|
*
|
|
4215
4131
|
* const dt = DateTime.makeZonedUnsafe("2024-06-15T14:30:00Z", {
|
|
@@ -4217,7 +4133,7 @@ export const formatLocal: {
|
|
|
4217
4133
|
* })
|
|
4218
4134
|
*
|
|
4219
4135
|
* // Force UTC formatting regardless of time zone
|
|
4220
|
-
*
|
|
4136
|
+
* DateTime.formatUtc(dt, {
|
|
4221
4137
|
* year: "numeric",
|
|
4222
4138
|
* month: "2-digit",
|
|
4223
4139
|
* day: "2-digit",
|
|
@@ -4225,8 +4141,6 @@ export const formatLocal: {
|
|
|
4225
4141
|
* minute: "2-digit",
|
|
4226
4142
|
* timeZoneName: "short"
|
|
4227
4143
|
* })
|
|
4228
|
-
*
|
|
4229
|
-
* console.log(utcFormatted) // "06/15/2024, 02:30 PM UTC"
|
|
4230
4144
|
* ```
|
|
4231
4145
|
*
|
|
4232
4146
|
* @category formatting
|
|
@@ -4242,7 +4156,7 @@ export const formatUtc: {
|
|
|
4242
4156
|
*
|
|
4243
4157
|
* **Example** (Formatting DateTime values in UTC)
|
|
4244
4158
|
*
|
|
4245
|
-
* ```ts
|
|
4159
|
+
* ```ts import.meta.vitest
|
|
4246
4160
|
* import { DateTime } from "effect"
|
|
4247
4161
|
*
|
|
4248
4162
|
* const dt = DateTime.makeZonedUnsafe("2024-06-15T14:30:00Z", {
|
|
@@ -4250,7 +4164,7 @@ export const formatUtc: {
|
|
|
4250
4164
|
* })
|
|
4251
4165
|
*
|
|
4252
4166
|
* // Force UTC formatting regardless of time zone
|
|
4253
|
-
*
|
|
4167
|
+
* DateTime.formatUtc(dt, {
|
|
4254
4168
|
* year: "numeric",
|
|
4255
4169
|
* month: "2-digit",
|
|
4256
4170
|
* day: "2-digit",
|
|
@@ -4258,8 +4172,6 @@ export const formatUtc: {
|
|
|
4258
4172
|
* minute: "2-digit",
|
|
4259
4173
|
* timeZoneName: "short"
|
|
4260
4174
|
* })
|
|
4261
|
-
*
|
|
4262
|
-
* console.log(utcFormatted) // "06/15/2024, 02:30 PM UTC"
|
|
4263
4175
|
* ```
|
|
4264
4176
|
*
|
|
4265
4177
|
* @category formatting
|
|
@@ -4281,7 +4193,7 @@ export const formatUtc: {
|
|
|
4281
4193
|
*
|
|
4282
4194
|
* **Example** (Formatting DateTime values in UTC)
|
|
4283
4195
|
*
|
|
4284
|
-
* ```ts
|
|
4196
|
+
* ```ts import.meta.vitest
|
|
4285
4197
|
* import { DateTime } from "effect"
|
|
4286
4198
|
*
|
|
4287
4199
|
* const dt = DateTime.makeZonedUnsafe("2024-06-15T14:30:00Z", {
|
|
@@ -4289,7 +4201,7 @@ export const formatUtc: {
|
|
|
4289
4201
|
* })
|
|
4290
4202
|
*
|
|
4291
4203
|
* // Force UTC formatting regardless of time zone
|
|
4292
|
-
*
|
|
4204
|
+
* DateTime.formatUtc(dt, {
|
|
4293
4205
|
* year: "numeric",
|
|
4294
4206
|
* month: "2-digit",
|
|
4295
4207
|
* day: "2-digit",
|
|
@@ -4297,8 +4209,6 @@ export const formatUtc: {
|
|
|
4297
4209
|
* minute: "2-digit",
|
|
4298
4210
|
* timeZoneName: "short"
|
|
4299
4211
|
* })
|
|
4300
|
-
*
|
|
4301
|
-
* console.log(utcFormatted) // "06/15/2024, 02:30 PM UTC"
|
|
4302
4212
|
* ```
|
|
4303
4213
|
*
|
|
4304
4214
|
* @category formatting
|
|
@@ -4329,7 +4239,7 @@ export const formatUtc: {
|
|
|
4329
4239
|
*
|
|
4330
4240
|
* **Example** (Formatting DateTime values with custom formatters)
|
|
4331
4241
|
*
|
|
4332
|
-
* ```ts
|
|
4242
|
+
* ```ts import.meta.vitest
|
|
4333
4243
|
* import { DateTime } from "effect"
|
|
4334
4244
|
*
|
|
4335
4245
|
* const dt = DateTime.makeUnsafe("2024-06-15T14:30:00Z")
|
|
@@ -4344,8 +4254,7 @@ export const formatUtc: {
|
|
|
4344
4254
|
* timeZone: "Europe/Berlin"
|
|
4345
4255
|
* })
|
|
4346
4256
|
*
|
|
4347
|
-
*
|
|
4348
|
-
* console.log(formatted.length > 0) // true
|
|
4257
|
+
* DateTime.formatIntl(dt, formatter).length > 0 // => true
|
|
4349
4258
|
* ```
|
|
4350
4259
|
*
|
|
4351
4260
|
* @see {@link formatUtc} for formatting with options forced to UTC
|
|
@@ -4370,7 +4279,7 @@ export const formatIntl: {
|
|
|
4370
4279
|
*
|
|
4371
4280
|
* **Example** (Formatting DateTime values with custom formatters)
|
|
4372
4281
|
*
|
|
4373
|
-
* ```ts
|
|
4282
|
+
* ```ts import.meta.vitest
|
|
4374
4283
|
* import { DateTime } from "effect"
|
|
4375
4284
|
*
|
|
4376
4285
|
* const dt = DateTime.makeUnsafe("2024-06-15T14:30:00Z")
|
|
@@ -4385,8 +4294,7 @@ export const formatIntl: {
|
|
|
4385
4294
|
* timeZone: "Europe/Berlin"
|
|
4386
4295
|
* })
|
|
4387
4296
|
*
|
|
4388
|
-
*
|
|
4389
|
-
* console.log(formatted.length > 0) // true
|
|
4297
|
+
* DateTime.formatIntl(dt, formatter).length > 0 // => true
|
|
4390
4298
|
* ```
|
|
4391
4299
|
*
|
|
4392
4300
|
* @see {@link formatUtc} for formatting with options forced to UTC
|
|
@@ -4411,7 +4319,7 @@ export const formatIntl: {
|
|
|
4411
4319
|
*
|
|
4412
4320
|
* **Example** (Formatting DateTime values with custom formatters)
|
|
4413
4321
|
*
|
|
4414
|
-
* ```ts
|
|
4322
|
+
* ```ts import.meta.vitest
|
|
4415
4323
|
* import { DateTime } from "effect"
|
|
4416
4324
|
*
|
|
4417
4325
|
* const dt = DateTime.makeUnsafe("2024-06-15T14:30:00Z")
|
|
@@ -4426,8 +4334,7 @@ export const formatIntl: {
|
|
|
4426
4334
|
* timeZone: "Europe/Berlin"
|
|
4427
4335
|
* })
|
|
4428
4336
|
*
|
|
4429
|
-
*
|
|
4430
|
-
* console.log(formatted.length > 0) // true
|
|
4337
|
+
* DateTime.formatIntl(dt, formatter).length > 0 // => true
|
|
4431
4338
|
* ```
|
|
4432
4339
|
*
|
|
4433
4340
|
* @see {@link formatUtc} for formatting with options forced to UTC
|
|
@@ -4448,16 +4355,15 @@ export const formatIntl: {
|
|
|
4448
4355
|
*
|
|
4449
4356
|
* **Example** (Formatting DateTime values as ISO strings)
|
|
4450
4357
|
*
|
|
4451
|
-
* ```ts
|
|
4358
|
+
* ```ts import.meta.vitest
|
|
4452
4359
|
* import { DateTime } from "effect"
|
|
4453
4360
|
*
|
|
4454
|
-
*
|
|
4455
|
-
* console.log(DateTime.formatIso(dt)) // "2024-01-01T12:30:45.123Z"
|
|
4361
|
+
* DateTime.formatIso(DateTime.makeUnsafe("2024-01-01T12:30:45.123Z")) // => "2024-01-01T12:30:45.123Z"
|
|
4456
4362
|
*
|
|
4457
4363
|
* const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:30:45.123Z", {
|
|
4458
4364
|
* timeZone: "Europe/London"
|
|
4459
4365
|
* })
|
|
4460
|
-
*
|
|
4366
|
+
* DateTime.formatIso(zoned) // => "2024-01-01T12:30:45.123Z"
|
|
4461
4367
|
* ```
|
|
4462
4368
|
*
|
|
4463
4369
|
* @category formatting
|
|
@@ -4474,16 +4380,16 @@ export const formatIso: (self: DateTime) => string = Internal.formatIso
|
|
|
4474
4380
|
*
|
|
4475
4381
|
* **Example** (Formatting DateTime values as ISO dates)
|
|
4476
4382
|
*
|
|
4477
|
-
* ```ts
|
|
4383
|
+
* ```ts import.meta.vitest
|
|
4478
4384
|
* import { DateTime } from "effect"
|
|
4479
4385
|
*
|
|
4480
4386
|
* const dt = DateTime.makeUnsafe("2024-01-01T23:30:00Z")
|
|
4481
|
-
*
|
|
4387
|
+
* DateTime.formatIsoDate(dt) // => "2024-01-01"
|
|
4482
4388
|
*
|
|
4483
4389
|
* const zoned = DateTime.makeZonedUnsafe("2024-01-01T23:30:00Z", {
|
|
4484
4390
|
* timeZone: "Pacific/Auckland" // UTC+12/13
|
|
4485
4391
|
* })
|
|
4486
|
-
*
|
|
4392
|
+
* DateTime.formatIsoDate(zoned) // => "2024-01-02"
|
|
4487
4393
|
* ```
|
|
4488
4394
|
*
|
|
4489
4395
|
* @category formatting
|
|
@@ -4500,16 +4406,16 @@ export const formatIsoDate: (self: DateTime) => string = Internal.formatIsoDate
|
|
|
4500
4406
|
*
|
|
4501
4407
|
* **Example** (Formatting DateTime values as UTC ISO dates)
|
|
4502
4408
|
*
|
|
4503
|
-
* ```ts
|
|
4409
|
+
* ```ts import.meta.vitest
|
|
4504
4410
|
* import { DateTime } from "effect"
|
|
4505
4411
|
*
|
|
4506
4412
|
* const dt = DateTime.makeUnsafe("2024-01-01T23:30:00Z")
|
|
4507
|
-
*
|
|
4413
|
+
* DateTime.formatIsoDateUtc(dt) // => "2024-01-01"
|
|
4508
4414
|
*
|
|
4509
4415
|
* const zoned = DateTime.makeZonedUnsafe("2024-01-01T23:30:00Z", {
|
|
4510
4416
|
* timeZone: "Pacific/Auckland"
|
|
4511
4417
|
* })
|
|
4512
|
-
*
|
|
4418
|
+
* DateTime.formatIsoDateUtc(zoned) // => "2024-01-01"
|
|
4513
4419
|
* ```
|
|
4514
4420
|
*
|
|
4515
4421
|
* @category formatting
|
|
@@ -4527,16 +4433,16 @@ export const formatIsoDateUtc: (self: DateTime) => string = Internal.formatIsoDa
|
|
|
4527
4433
|
*
|
|
4528
4434
|
* **Example** (Formatting DateTime values with offsets)
|
|
4529
4435
|
*
|
|
4530
|
-
* ```ts
|
|
4436
|
+
* ```ts import.meta.vitest
|
|
4531
4437
|
* import { DateTime } from "effect"
|
|
4532
4438
|
*
|
|
4533
4439
|
* const utc = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
|
|
4534
|
-
*
|
|
4440
|
+
* DateTime.formatIsoOffset(utc) // => "2024-01-01T12:00:00.000Z"
|
|
4535
4441
|
*
|
|
4536
4442
|
* const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
|
|
4537
4443
|
* timeZone: DateTime.zoneMakeOffset(3 * 60 * 60 * 1000)
|
|
4538
4444
|
* })
|
|
4539
|
-
*
|
|
4445
|
+
* DateTime.formatIsoOffset(zoned) // => "2024-01-01T15:00:00.000+03:00"
|
|
4540
4446
|
* ```
|
|
4541
4447
|
*
|
|
4542
4448
|
* @category formatting
|
|
@@ -4553,22 +4459,20 @@ export const formatIsoOffset: (self: DateTime) => string = Internal.formatIsoOff
|
|
|
4553
4459
|
*
|
|
4554
4460
|
* **Example** (Formatting zoned DateTime values)
|
|
4555
4461
|
*
|
|
4556
|
-
* ```ts
|
|
4462
|
+
* ```ts import.meta.vitest
|
|
4557
4463
|
* import { DateTime } from "effect"
|
|
4558
4464
|
*
|
|
4559
4465
|
* const zoned = DateTime.makeZonedUnsafe("2024-06-15T14:30:45.123Z", {
|
|
4560
4466
|
* timeZone: "Europe/London"
|
|
4561
4467
|
* })
|
|
4562
4468
|
*
|
|
4563
|
-
*
|
|
4564
|
-
* console.log(formatted) // "2024-06-15T15:30:45.123+01:00[Europe/London]"
|
|
4469
|
+
* DateTime.formatIsoZoned(zoned) // => "2024-06-15T15:30:45.123+01:00[Europe/London]"
|
|
4565
4470
|
*
|
|
4566
4471
|
* const offsetZone = DateTime.makeZonedUnsafe("2024-06-15T14:30:45.123Z", {
|
|
4567
4472
|
* timeZone: DateTime.zoneMakeOffset(3 * 60 * 60 * 1000)
|
|
4568
4473
|
* })
|
|
4569
4474
|
*
|
|
4570
|
-
*
|
|
4571
|
-
* console.log(offsetFormatted) // "2024-06-15T17:30:45.123+03:00"
|
|
4475
|
+
* DateTime.formatIsoZoned(offsetZone) // => "2024-06-15T17:30:45.123+03:00"
|
|
4572
4476
|
* ```
|
|
4573
4477
|
*
|
|
4574
4478
|
* @category formatting
|
|
@@ -4585,7 +4489,7 @@ export const formatIsoZoned: (self: Zoned) => string = Internal.formatIsoZoned
|
|
|
4585
4489
|
*
|
|
4586
4490
|
* **Example** (Providing current time zone layers)
|
|
4587
4491
|
*
|
|
4588
|
-
* ```ts
|
|
4492
|
+
* ```ts import.meta.vitest
|
|
4589
4493
|
* import { DateTime, Effect } from "effect"
|
|
4590
4494
|
*
|
|
4591
4495
|
* const zone = DateTime.zoneMakeNamedUnsafe("Europe/London")
|
|
@@ -4593,14 +4497,14 @@ export const formatIsoZoned: (self: Zoned) => string = Internal.formatIsoZoned
|
|
|
4593
4497
|
*
|
|
4594
4498
|
* const program = Effect.gen(function*() {
|
|
4595
4499
|
* const now = yield* DateTime.nowInCurrentZone
|
|
4596
|
-
* return DateTime.
|
|
4500
|
+
* return DateTime.zoneToString(now.zone)
|
|
4597
4501
|
* })
|
|
4598
4502
|
*
|
|
4599
4503
|
* // Use the layer to provide the time zone
|
|
4600
|
-
* Effect.provide(program, layer)
|
|
4504
|
+
* await Effect.runPromise(Effect.provide(program, layer)) // => "Europe/London"
|
|
4601
4505
|
* ```
|
|
4602
4506
|
*
|
|
4603
|
-
* @category
|
|
4507
|
+
* @category layers
|
|
4604
4508
|
* @since 3.6.0
|
|
4605
4509
|
*/
|
|
4606
4510
|
export const layerCurrentZone: (resource: NoInfer<TimeZone>) => Layer.Layer<CurrentTimeZone> = Layer.succeed(
|
|
@@ -4616,7 +4520,7 @@ export const layerCurrentZone: (resource: NoInfer<TimeZone>) => Layer.Layer<Curr
|
|
|
4616
4520
|
*
|
|
4617
4521
|
* **Example** (Providing fixed-offset time zone layers)
|
|
4618
4522
|
*
|
|
4619
|
-
* ```ts
|
|
4523
|
+
* ```ts import.meta.vitest
|
|
4620
4524
|
* import { DateTime, Effect } from "effect"
|
|
4621
4525
|
*
|
|
4622
4526
|
* // Create a layer for UTC+3
|
|
@@ -4624,13 +4528,13 @@ export const layerCurrentZone: (resource: NoInfer<TimeZone>) => Layer.Layer<Curr
|
|
|
4624
4528
|
*
|
|
4625
4529
|
* const program = Effect.gen(function*() {
|
|
4626
4530
|
* const now = yield* DateTime.nowInCurrentZone
|
|
4627
|
-
* return DateTime.
|
|
4531
|
+
* return DateTime.zoneToString(now.zone)
|
|
4628
4532
|
* })
|
|
4629
4533
|
*
|
|
4630
|
-
* Effect.provide(program, layer)
|
|
4534
|
+
* await Effect.runPromise(Effect.provide(program, layer)) // => "+03:00"
|
|
4631
4535
|
* ```
|
|
4632
4536
|
*
|
|
4633
|
-
* @category
|
|
4537
|
+
* @category layers
|
|
4634
4538
|
* @since 3.6.0
|
|
4635
4539
|
*/
|
|
4636
4540
|
export const layerCurrentZoneOffset = (offset: number): Layer.Layer<CurrentTimeZone> =>
|
|
@@ -4646,20 +4550,20 @@ export const layerCurrentZoneOffset = (offset: number): Layer.Layer<CurrentTimeZ
|
|
|
4646
4550
|
*
|
|
4647
4551
|
* **Example** (Providing named time zone layers)
|
|
4648
4552
|
*
|
|
4649
|
-
* ```ts
|
|
4553
|
+
* ```ts import.meta.vitest
|
|
4650
4554
|
* import { DateTime, Effect } from "effect"
|
|
4651
4555
|
*
|
|
4652
4556
|
* const layer = DateTime.layerCurrentZoneNamed("Europe/London")
|
|
4653
4557
|
*
|
|
4654
4558
|
* const program = Effect.gen(function*() {
|
|
4655
4559
|
* const now = yield* DateTime.nowInCurrentZone
|
|
4656
|
-
* return DateTime.
|
|
4560
|
+
* return DateTime.zoneToString(now.zone)
|
|
4657
4561
|
* })
|
|
4658
4562
|
*
|
|
4659
|
-
* Effect.provide(program, layer)
|
|
4563
|
+
* await Effect.runPromise(Effect.provide(program, layer)) // => "Europe/London"
|
|
4660
4564
|
* ```
|
|
4661
4565
|
*
|
|
4662
|
-
* @category
|
|
4566
|
+
* @category layers
|
|
4663
4567
|
* @since 3.6.0
|
|
4664
4568
|
*/
|
|
4665
4569
|
export const layerCurrentZoneNamed: (zoneId: string) => Layer.Layer<
|
|
@@ -4677,19 +4581,19 @@ export const layerCurrentZoneNamed: (zoneId: string) => Layer.Layer<
|
|
|
4677
4581
|
*
|
|
4678
4582
|
* **Example** (Providing local time zone layers)
|
|
4679
4583
|
*
|
|
4680
|
-
* ```ts
|
|
4584
|
+
* ```ts import.meta.vitest
|
|
4681
4585
|
* import { DateTime, Effect } from "effect"
|
|
4682
4586
|
*
|
|
4683
4587
|
* const program = Effect.gen(function*() {
|
|
4684
4588
|
* const now = yield* DateTime.nowInCurrentZone
|
|
4685
|
-
* return DateTime.
|
|
4589
|
+
* return DateTime.isZoned(now)
|
|
4686
4590
|
* })
|
|
4687
4591
|
*
|
|
4688
4592
|
* // Use the system's local time zone
|
|
4689
|
-
* Effect.provide(program, DateTime.layerCurrentZoneLocal)
|
|
4593
|
+
* await Effect.runPromise(Effect.provide(program, DateTime.layerCurrentZoneLocal)) // => true
|
|
4690
4594
|
* ```
|
|
4691
4595
|
*
|
|
4692
|
-
* @category
|
|
4596
|
+
* @category layers
|
|
4693
4597
|
* @since 3.6.0
|
|
4694
4598
|
*/
|
|
4695
4599
|
export const layerCurrentZoneLocal: Layer.Layer<CurrentTimeZone> = Layer.sync(CurrentTimeZone)(zoneMakeLocal)
|