@glutinum/cli 0.13.0 → 0.14.1
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/README.md +19 -1
- package/dist/Glutinum.Converter/Abbreviations.js +246 -0
- package/dist/Glutinum.Converter/FsharpAST.js +87 -28
- package/dist/Glutinum.Converter/Generate.js +55 -8
- package/dist/Glutinum.Converter/GlueAST.js +333 -34
- package/dist/Glutinum.Converter/Log.js +7 -8
- package/dist/Glutinum.Converter/Merge.js +683 -31
- package/dist/Glutinum.Converter/Packages.js +308 -0
- package/dist/Glutinum.Converter/Printer.js +323 -186
- package/dist/Glutinum.Converter/Read.js +279 -6
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js +13 -7
- package/dist/Glutinum.Converter/Reader/Declaration.js +102 -17
- package/dist/Glutinum.Converter/Reader/Documentation.js +168 -73
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js +7 -51
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js +64 -15
- package/dist/Glutinum.Converter/Reader/ExportDeclaration.js +165 -0
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js +30 -5
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js +122 -4
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js +83 -7
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js +8 -8
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js +11 -9
- package/dist/Glutinum.Converter/Reader/NamedTupleMember.js +3 -2
- package/dist/Glutinum.Converter/Reader/Node.js +24 -10
- package/dist/Glutinum.Converter/Reader/Parameters.js +110 -7
- package/dist/Glutinum.Converter/Reader/Report.js +31 -12
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js +4 -3
- package/dist/Glutinum.Converter/Reader/TypeNode.js +1524 -253
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js +75 -20
- package/dist/Glutinum.Converter/Reader/TypeParameters.js +8 -5
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js +184 -50
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js +32 -13
- package/dist/Glutinum.Converter/Reader/Types.js +180 -0
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js +99 -43
- package/dist/Glutinum.Converter/Reader/Utils.js +1143 -55
- package/dist/Glutinum.Converter/Reader/VariableStatement.js +59 -14
- package/dist/Glutinum.Converter/Transform.js +8292 -1119
- package/dist/Glutinum.Converter/TypeScript.Extensions.js +3 -3
- package/dist/Glutinum.Converter/TypeScript.js +3 -3
- package/dist/Glutinum.Converter/Utils/Keywords.js +6 -6
- package/dist/Glutinum.Converter/Utils/List.js +3 -3
- package/dist/Glutinum.Converter/Utils/Naming.js +61 -12
- package/dist/Glutinum.Converter/Utils/String.js +7 -3
- package/dist/Program.js +230 -72
- package/dist/fable_modules/Fable.Promise.3.2.1/AsyncIterable.fs +89 -0
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/AsyncIterable.fs.js +29 -29
- package/dist/fable_modules/Fable.Promise.3.2.1/Fable.Promise.fableproj +25 -0
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/Promise.fs +842 -766
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/Promise.fs.js +26 -12
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/PromiseImpl.fs +31 -31
- package/dist/fable_modules/{Fable.Promise.3.2.0 → Fable.Promise.3.2.1}/PromiseImpl.fs.js +5 -5
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs +235 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Array.fs.js +384 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AssemblyInfo.fs +4 -4
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Async.fs +89 -9
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Async.fs.js +13 -12
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOption.fs +50 -4
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionCE.fs +30 -39
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionCE.fs.js +10 -10
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResult.fs +52 -8
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultCE.fs +26 -42
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultCE.fs.js +3 -3
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOption.fs +17 -5
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/AsyncResultOption.fs.js +26 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionCE.fs +31 -33
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionCE.fs.js +3 -3
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidation.fs +1 -6
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationCE.fs +10 -18
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationCE.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/FsToolkit.ErrorHandling.fableproj +69 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/List.fs +68 -10
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/List.fs.js +47 -41
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Nullness.fs +81 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Option.fs +133 -2
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs +139 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/OptionCE.fs.js +48 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/OptionOp.fs +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs +88 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResult.fs.js +30 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs +200 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncResultCE.fs.js +18 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidation.fs +34 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs +244 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ParallelAsyncValidationCE.fs.js +18 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Result.fs +87 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Result.fs.js +8 -8
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultCE.fs +8 -23
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultCE.fs.js +5 -5
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOption.fs +1 -1
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOption.fs.js +10 -10
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionCE.fs +7 -18
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionCE.fs.js +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs +503 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/Seq.fs.js +295 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/Validation.fs +0 -5
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationCE.fs +7 -13
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationCE.fs.js +3 -3
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValueOption.fs +1 -4
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOption.fs +102 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionCE.fs +587 -0
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/ValueTaskValueOptionOp.fs +10 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Debug/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +3 -3
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.fs +3 -0
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0/obj/Release/netstandard2.1 → FsToolkit.ErrorHandling.5.2.0/obj/Release/net9.0}/FsToolkit.ErrorHandling.AssemblyInfo.fs +4 -4
- package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.0/FsToolkit.ErrorHandling.AssemblyInfo.fs +4 -4
- package/dist/fable_modules/FsToolkit.ErrorHandling.5.2.0/obj/Release/netstandard2.1/FsToolkit.ErrorHandling.AssemblyInfo.fs +20 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Array.js +192 -86
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Async.js +58 -53
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/AsyncBuilder.js +29 -8
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/BigInt.js +71 -46
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/BitConverter.js +2 -2
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Boolean.js +4 -3
- package/dist/fable_modules/fable-library-js.5.17.2/CHANGELOG.md +348 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Char.js +64 -31
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Choice.js +2 -2
- package/dist/fable_modules/fable-library-js.5.17.2/CollectionUtil.js +182 -0
- package/dist/fable_modules/fable-library-js.5.17.2/ConditionalWeakTable.js +21 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Date.js +197 -112
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/DateOffset.js +46 -62
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/DateOnly.js +6 -6
- package/dist/fable_modules/fable-library-js.5.17.2/DateOnlyTemporal.js +146 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeFormat.js +523 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeOffsetTemporal.js +283 -0
- package/dist/fable_modules/fable-library-js.5.17.2/DateTimeTemporal.js +243 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Decimal.js +39 -13
- package/dist/fable_modules/fable-library-js.5.17.2/Directory.js +11 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Double.js +10 -3
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Encoding.js +20 -8
- package/dist/fable_modules/fable-library-js.5.17.2/Environment.js +3 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Event.js +10 -1
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Collections.js +45 -0
- package/dist/fable_modules/fable-library-js.5.17.2/FSharp.Core.js +156 -0
- package/dist/fable_modules/fable-library-js.5.17.2/File.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Global.js +29 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Guid.js +33 -12
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Int32.js +17 -17
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/List.js +170 -106
- package/dist/fable_modules/fable-library-js.5.17.2/Long.js +38 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MailboxProcessor.js +13 -6
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Map.js +65 -61
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MapUtil.js +22 -4
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MutableMap.js +28 -16
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/MutableSet.js +7 -7
- package/dist/fable_modules/fable-library-js.5.17.2/Native.js +14 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Numeric.js +44 -3
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Observable.js +5 -3
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Option.js +11 -20
- package/dist/fable_modules/fable-library-js.5.17.2/Path.js +31 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Random.js +22 -20
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Range.js +12 -12
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Reflection.js +50 -22
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/RegExp.js +68 -30
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Result.js +6 -6
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Seq.js +229 -104
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Seq2.js +1 -1
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Set.js +153 -113
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/String.js +238 -50
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/System.Collections.Generic.js +30 -14
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/System.Text.js +69 -31
- package/dist/fable_modules/fable-library-js.5.17.2/System.js +289 -0
- package/dist/fable_modules/fable-library-js.5.17.2/Task.js +27 -0
- package/dist/fable_modules/fable-library-js.5.17.2/TaskBuilder.js +72 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/TimeOnly.js +6 -6
- package/dist/fable_modules/fable-library-js.5.17.2/TimeOnlyTemporal.js +142 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/TimeSpan.js +18 -15
- package/dist/fable_modules/fable-library-js.5.17.2/TimeSpanTemporal.js +259 -0
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Types.js +14 -24
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Uri.js +44 -21
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Util.js +49 -12
- package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/lib/big.js +14 -11
- package/dist/fable_modules/fable-library-js.5.17.2/package.json +24 -0
- package/dist/fable_modules/fable-library-js.5.17.2/quotation.js +682 -0
- package/package.json +4 -4
- package/src/Glutinum.Converter/js/bootstrap.js +109 -2
- package/src/Glutinum.Converter/js/host.js +144 -0
- package/src/Glutinum.Converter/js/npm.js +137 -0
- package/src/Glutinum.Converter/js/resolve.js +402 -0
- package/dist/Glutinum.Converter/FsharpAST.js.map +0 -1
- package/dist/Glutinum.Converter/Generate.js.map +0 -1
- package/dist/Glutinum.Converter/GlueAST.js.map +0 -1
- package/dist/Glutinum.Converter/Log.js.map +0 -1
- package/dist/Glutinum.Converter/Merge.js.map +0 -1
- package/dist/Glutinum.Converter/Printer.js.map +0 -1
- package/dist/Glutinum.Converter/Read.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/ClassDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Declaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Documentation.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/EnumDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/ExportAssignment.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/FunctionDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/IndexedAccessType.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/InterfaceDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/MappedTypeNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/ModuleDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/NamedTupleMember.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Node.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Parameters.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Report.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeAliasDeclaration.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeOperatorNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeParameters.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeQueryNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/TypeScriptReader.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/UnionTypeNode.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/Utils.js.map +0 -1
- package/dist/Glutinum.Converter/Reader/VariableStatement.js.map +0 -1
- package/dist/Glutinum.Converter/Transform.js.map +0 -1
- package/dist/Glutinum.Converter/TypeScript.Extensions.js.map +0 -1
- package/dist/Glutinum.Converter/TypeScript.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/Keywords.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/List.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/Naming.js.map +0 -1
- package/dist/Glutinum.Converter/Utils/String.js.map +0 -1
- package/dist/Program.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs +0 -57
- package/dist/fable_modules/Fable.Promise.3.2.0/AsyncIterable.fs.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/Fable.Promise.fableproj +0 -20
- package/dist/fable_modules/Fable.Promise.3.2.0/Promise.fs.js.map +0 -1
- package/dist/fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Async.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js +0 -26
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOption.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncResultOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/AsyncValidationCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/FsToolkit.ErrorHandling.fableproj +0 -51
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/List.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs +0 -186
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/OptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Result.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOption.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ResultOptionCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs +0 -19
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js +0 -31
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Seq.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs +0 -22
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js +0 -18
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/Shims.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValidationCE.fs.js.map +0 -1
- package/dist/fable_modules/FsToolkit.ErrorHandling.4.16.0/ValueOptionCE.fs +0 -165
- package/dist/fable_modules/fable-library-js.4.14.0/Array.d.ts +0 -123
- package/dist/fable_modules/fable-library-js.4.14.0/Async.d.ts +0 -32
- package/dist/fable_modules/fable-library-js.4.14.0/AsyncBuilder.d.ts +0 -59
- package/dist/fable_modules/fable-library-js.4.14.0/BigInt.d.ts +0 -115
- package/dist/fable_modules/fable-library-js.4.14.0/BitConverter.d.ts +0 -27
- package/dist/fable_modules/fable-library-js.4.14.0/Boolean.d.ts +0 -3
- package/dist/fable_modules/fable-library-js.4.14.0/CHANGELOG.md +0 -37
- package/dist/fable_modules/fable-library-js.4.14.0/Char.d.ts +0 -65
- package/dist/fable_modules/fable-library-js.4.14.0/Choice.d.ts +0 -121
- package/dist/fable_modules/fable-library-js.4.14.0/Date.d.ts +0 -70
- package/dist/fable_modules/fable-library-js.4.14.0/DateOffset.d.ts +0 -63
- package/dist/fable_modules/fable-library-js.4.14.0/DateOnly.d.ts +0 -18
- package/dist/fable_modules/fable-library-js.4.14.0/Decimal.d.ts +0 -45
- package/dist/fable_modules/fable-library-js.4.14.0/Double.d.ts +0 -11
- package/dist/fable_modules/fable-library-js.4.14.0/Encoding.d.ts +0 -12
- package/dist/fable_modules/fable-library-js.4.14.0/Event.d.ts +0 -31
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.d.ts +0 -7
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Collections.js +0 -27
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.CompilerServices.d.ts +0 -12
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.d.ts +0 -17
- package/dist/fable_modules/fable-library-js.4.14.0/FSharp.Core.js +0 -69
- package/dist/fable_modules/fable-library-js.4.14.0/Global.d.ts +0 -24
- package/dist/fable_modules/fable-library-js.4.14.0/Global.js +0 -8
- package/dist/fable_modules/fable-library-js.4.14.0/Guid.d.ts +0 -10
- package/dist/fable_modules/fable-library-js.4.14.0/Int32.d.ts +0 -28
- package/dist/fable_modules/fable-library-js.4.14.0/List.d.ts +0 -143
- package/dist/fable_modules/fable-library-js.4.14.0/Long.d.ts +0 -3
- package/dist/fable_modules/fable-library-js.4.14.0/Long.js +0 -46
- package/dist/fable_modules/fable-library-js.4.14.0/MailboxProcessor.d.ts +0 -25
- package/dist/fable_modules/fable-library-js.4.14.0/Map.d.ts +0 -178
- package/dist/fable_modules/fable-library-js.4.14.0/MapUtil.d.ts +0 -10
- package/dist/fable_modules/fable-library-js.4.14.0/MutableMap.d.ts +0 -52
- package/dist/fable_modules/fable-library-js.4.14.0/MutableSet.d.ts +0 -39
- package/dist/fable_modules/fable-library-js.4.14.0/Native.d.ts +0 -2
- package/dist/fable_modules/fable-library-js.4.14.0/Native.js +0 -8
- package/dist/fable_modules/fable-library-js.4.14.0/Numeric.d.ts +0 -19
- package/dist/fable_modules/fable-library-js.4.14.0/Observable.d.ts +0 -32
- package/dist/fable_modules/fable-library-js.4.14.0/Option.d.ts +0 -28
- package/dist/fable_modules/fable-library-js.4.14.0/Random.d.ts +0 -37
- package/dist/fable_modules/fable-library-js.4.14.0/Range.d.ts +0 -12
- package/dist/fable_modules/fable-library-js.4.14.0/Reflection.d.ts +0 -119
- package/dist/fable_modules/fable-library-js.4.14.0/RegExp.d.ts +0 -10
- package/dist/fable_modules/fable-library-js.4.14.0/Result.d.ts +0 -37
- package/dist/fable_modules/fable-library-js.4.14.0/Seq.d.ts +0 -165
- package/dist/fable_modules/fable-library-js.4.14.0/Seq2.d.ts +0 -18
- package/dist/fable_modules/fable-library-js.4.14.0/Set.d.ts +0 -190
- package/dist/fable_modules/fable-library-js.4.14.0/String.d.ts +0 -50
- package/dist/fable_modules/fable-library-js.4.14.0/System.Collections.Generic.d.ts +0 -79
- package/dist/fable_modules/fable-library-js.4.14.0/System.Text.d.ts +0 -38
- package/dist/fable_modules/fable-library-js.4.14.0/SystemException.d.ts +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/SystemException.js +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/TimeOnly.d.ts +0 -15
- package/dist/fable_modules/fable-library-js.4.14.0/TimeSpan.d.ts +0 -34
- package/dist/fable_modules/fable-library-js.4.14.0/Timer.d.ts +0 -19
- package/dist/fable_modules/fable-library-js.4.14.0/Types.d.ts +0 -58
- package/dist/fable_modules/fable-library-js.4.14.0/Unicode.13.0.0.d.ts +0 -2
- package/dist/fable_modules/fable-library-js.4.14.0/Uri.d.ts +0 -29
- package/dist/fable_modules/fable-library-js.4.14.0/Util.d.ts +0 -207
- package/dist/fable_modules/fable-library-js.4.14.0/lib/big.d.ts +0 -5
- package/dist/fable_modules/fable-library-js.4.14.0/package.json +0 -24
- package/dist/fable_modules/project_cracked.json +0 -1
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncOptionOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncResultOptionOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/AsyncValidationOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ResultOptionOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/ValidationOp.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Debug/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /package/dist/fable_modules/{FsToolkit.ErrorHandling.4.16.0 → FsToolkit.ErrorHandling.5.2.0}/obj/Release/netstandard2.1/.NETStandard,Version=v2.1.AssemblyAttributes.fs +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/FSharp.Core.CompilerServices.js +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/README.md +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Timer.js +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/Unicode.13.0.0.js +0 -0
- /package/dist/fable_modules/{fable-library-js.4.14.0 → fable-library-js.5.17.2}/big.d.ts +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class ConditionalWeakTable {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.weakMap = new WeakMap();
|
|
4
|
+
}
|
|
5
|
+
delete(key) {
|
|
6
|
+
return this.weakMap.delete(key);
|
|
7
|
+
}
|
|
8
|
+
get(key) {
|
|
9
|
+
return this.weakMap.get(key);
|
|
10
|
+
}
|
|
11
|
+
has(key) {
|
|
12
|
+
return this.weakMap.has(key);
|
|
13
|
+
}
|
|
14
|
+
set(key, value) {
|
|
15
|
+
return this.weakMap.set(key, value);
|
|
16
|
+
}
|
|
17
|
+
clear() {
|
|
18
|
+
this.weakMap = new WeakMap();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export default ConditionalWeakTable;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Basically; invariant: date.getTime() always return UTC time.
|
|
9
9
|
*/
|
|
10
10
|
import { toInt64, toFloat64 } from "./BigInt.js";
|
|
11
|
-
import { compareDates, dateOffset, padWithZeros } from "./Util.js";
|
|
11
|
+
import { Exception, compareDates, DateTimeKind, dateOffset, padWithZeros } from "./Util.js";
|
|
12
12
|
const shortDays = [
|
|
13
13
|
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
|
14
14
|
];
|
|
@@ -56,7 +56,7 @@ function parseQuotedString(format, pos) {
|
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
58
|
// This means that '\' is the last character in the string.
|
|
59
|
-
throw new
|
|
59
|
+
throw new Exception("Invalid string format");
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
@@ -65,7 +65,7 @@ function parseQuotedString(format, pos) {
|
|
|
65
65
|
}
|
|
66
66
|
if (!foundQuote) {
|
|
67
67
|
// We could not find the matching quote
|
|
68
|
-
throw new
|
|
68
|
+
throw new Exception(`Invalid string format could not find matching quote for ${quoteChar}`);
|
|
69
69
|
}
|
|
70
70
|
return [result, pos - beginPos + 1];
|
|
71
71
|
}
|
|
@@ -73,7 +73,7 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
73
73
|
let cursorPos = 0;
|
|
74
74
|
let tokenLength = 0;
|
|
75
75
|
let result = "";
|
|
76
|
-
const localizedDate = utc ? DateTime(date.getTime(),
|
|
76
|
+
const localizedDate = utc ? DateTime(date.getTime(), DateTimeKind.Utc) : date;
|
|
77
77
|
while (cursorPos < format.length) {
|
|
78
78
|
const token = format[cursorPos];
|
|
79
79
|
switch (token) {
|
|
@@ -82,18 +82,17 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
82
82
|
cursorPos += tokenLength;
|
|
83
83
|
switch (tokenLength) {
|
|
84
84
|
case 1:
|
|
85
|
-
result += localizedDate
|
|
85
|
+
result += day(localizedDate);
|
|
86
86
|
break;
|
|
87
87
|
case 2:
|
|
88
|
-
result += padWithZeros(localizedDate
|
|
88
|
+
result += padWithZeros(day(localizedDate), 2);
|
|
89
89
|
break;
|
|
90
90
|
case 3:
|
|
91
91
|
result += shortDays[dayOfWeek(localizedDate)];
|
|
92
92
|
break;
|
|
93
93
|
case 4:
|
|
94
|
-
result += longDays[dayOfWeek(localizedDate)];
|
|
95
|
-
break;
|
|
96
94
|
default:
|
|
95
|
+
result += longDays[dayOfWeek(localizedDate)];
|
|
97
96
|
break;
|
|
98
97
|
}
|
|
99
98
|
break;
|
|
@@ -112,6 +111,9 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
112
111
|
// DateTime(1, 2, 3, 4, 5, 6, DateTimeKind.Utc).ToString("fffff") => 00000
|
|
113
112
|
result += ("" + millisecond(localizedDate)).padEnd(tokenLength, "0");
|
|
114
113
|
}
|
|
114
|
+
else {
|
|
115
|
+
throw "Input string was not in a correct format.";
|
|
116
|
+
}
|
|
115
117
|
break;
|
|
116
118
|
case "F":
|
|
117
119
|
tokenLength = parseRepeatToken(format, cursorPos, "F");
|
|
@@ -132,25 +134,27 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
132
134
|
result += padWithZeros(value, 3);
|
|
133
135
|
}
|
|
134
136
|
}
|
|
137
|
+
else {
|
|
138
|
+
throw "Input string was not in a correct format.";
|
|
139
|
+
}
|
|
135
140
|
break;
|
|
136
141
|
case "g":
|
|
137
142
|
tokenLength = parseRepeatToken(format, cursorPos, "g");
|
|
138
143
|
cursorPos += tokenLength;
|
|
139
|
-
|
|
140
|
-
result += "A.D.";
|
|
141
|
-
}
|
|
144
|
+
result += "A.D.";
|
|
142
145
|
break;
|
|
143
146
|
case "h":
|
|
144
147
|
tokenLength = parseRepeatToken(format, cursorPos, "h");
|
|
145
148
|
cursorPos += tokenLength;
|
|
146
149
|
switch (tokenLength) {
|
|
147
150
|
case 1:
|
|
148
|
-
|
|
151
|
+
const h1Value = hour(localizedDate) % 12;
|
|
152
|
+
result += h1Value ? h1Value : 12;
|
|
149
153
|
break;
|
|
150
154
|
case 2:
|
|
151
|
-
result += padWithZeros(hour(localizedDate) % 12, 2);
|
|
152
|
-
break;
|
|
153
155
|
default:
|
|
156
|
+
const h2Value = hour(localizedDate) % 12;
|
|
157
|
+
result += padWithZeros(h2Value ? h2Value : 12, 2);
|
|
154
158
|
break;
|
|
155
159
|
}
|
|
156
160
|
break;
|
|
@@ -162,9 +166,8 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
162
166
|
result += hour(localizedDate);
|
|
163
167
|
break;
|
|
164
168
|
case 2:
|
|
165
|
-
result += padWithZeros(hour(localizedDate), 2);
|
|
166
|
-
break;
|
|
167
169
|
default:
|
|
170
|
+
result += padWithZeros(hour(localizedDate), 2);
|
|
168
171
|
break;
|
|
169
172
|
}
|
|
170
173
|
break;
|
|
@@ -173,14 +176,14 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
173
176
|
cursorPos += tokenLength;
|
|
174
177
|
switch (tokenLength) {
|
|
175
178
|
case 1:
|
|
176
|
-
switch (
|
|
177
|
-
case
|
|
179
|
+
switch (getKind(localizedDate)) {
|
|
180
|
+
case DateTimeKind.Utc:
|
|
178
181
|
result += "Z";
|
|
179
182
|
break;
|
|
180
|
-
case
|
|
183
|
+
case DateTimeKind.Local:
|
|
181
184
|
result += dateOffsetToString(localizedDate.getTimezoneOffset() * -60000);
|
|
182
185
|
break;
|
|
183
|
-
case
|
|
186
|
+
case DateTimeKind.Unspecified:
|
|
184
187
|
break;
|
|
185
188
|
}
|
|
186
189
|
break;
|
|
@@ -196,9 +199,8 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
196
199
|
result += minute(localizedDate);
|
|
197
200
|
break;
|
|
198
201
|
case 2:
|
|
199
|
-
result += padWithZeros(minute(localizedDate), 2);
|
|
200
|
-
break;
|
|
201
202
|
default:
|
|
203
|
+
result += padWithZeros(minute(localizedDate), 2);
|
|
202
204
|
break;
|
|
203
205
|
}
|
|
204
206
|
break;
|
|
@@ -216,9 +218,8 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
216
218
|
result += shortMonths[month(localizedDate) - 1];
|
|
217
219
|
break;
|
|
218
220
|
case 4:
|
|
219
|
-
result += longMonths[month(localizedDate) - 1];
|
|
220
|
-
break;
|
|
221
221
|
default:
|
|
222
|
+
result += longMonths[month(localizedDate) - 1];
|
|
222
223
|
break;
|
|
223
224
|
}
|
|
224
225
|
break;
|
|
@@ -230,9 +231,8 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
230
231
|
result += second(localizedDate);
|
|
231
232
|
break;
|
|
232
233
|
case 2:
|
|
233
|
-
result += padWithZeros(second(localizedDate), 2);
|
|
234
|
-
break;
|
|
235
234
|
default:
|
|
235
|
+
result += padWithZeros(second(localizedDate), 2);
|
|
236
236
|
break;
|
|
237
237
|
}
|
|
238
238
|
break;
|
|
@@ -244,9 +244,8 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
244
244
|
result += localizedDate.getHours() < 12 ? "A" : "P";
|
|
245
245
|
break;
|
|
246
246
|
case 2:
|
|
247
|
-
result += localizedDate.getHours() < 12 ? "AM" : "PM";
|
|
248
|
-
break;
|
|
249
247
|
default:
|
|
248
|
+
result += localizedDate.getHours() < 12 ? "AM" : "PM";
|
|
250
249
|
break;
|
|
251
250
|
}
|
|
252
251
|
break;
|
|
@@ -255,21 +254,13 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
255
254
|
cursorPos += tokenLength;
|
|
256
255
|
switch (tokenLength) {
|
|
257
256
|
case 1:
|
|
258
|
-
result += localizedDate
|
|
257
|
+
result += year(localizedDate) % 100;
|
|
259
258
|
break;
|
|
260
259
|
case 2:
|
|
261
|
-
result += padWithZeros(localizedDate
|
|
262
|
-
break;
|
|
263
|
-
case 3:
|
|
264
|
-
result += padWithZeros(localizedDate.getFullYear(), 3);
|
|
265
|
-
break;
|
|
266
|
-
case 4:
|
|
267
|
-
result += padWithZeros(localizedDate.getFullYear(), 4);
|
|
268
|
-
break;
|
|
269
|
-
case 5:
|
|
270
|
-
result += padWithZeros(localizedDate.getFullYear(), 5);
|
|
260
|
+
result += padWithZeros(year(localizedDate) % 100, 2);
|
|
271
261
|
break;
|
|
272
262
|
default:
|
|
263
|
+
result += padWithZeros(year(localizedDate), tokenLength);
|
|
273
264
|
break;
|
|
274
265
|
}
|
|
275
266
|
break;
|
|
@@ -277,14 +268,14 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
277
268
|
tokenLength = parseRepeatToken(format, cursorPos, "z");
|
|
278
269
|
cursorPos += tokenLength;
|
|
279
270
|
let utcOffsetText = "";
|
|
280
|
-
switch (
|
|
281
|
-
case
|
|
271
|
+
switch (getKind(localizedDate)) {
|
|
272
|
+
case DateTimeKind.Utc:
|
|
282
273
|
utcOffsetText = "+00:00";
|
|
283
274
|
break;
|
|
284
|
-
case
|
|
275
|
+
case DateTimeKind.Local:
|
|
285
276
|
utcOffsetText = dateOffsetToString(localizedDate.getTimezoneOffset() * -60000);
|
|
286
277
|
break;
|
|
287
|
-
case
|
|
278
|
+
case DateTimeKind.Unspecified:
|
|
288
279
|
utcOffsetText = dateOffsetToString(toLocalTime(localizedDate).getTimezoneOffset() * -60000);
|
|
289
280
|
break;
|
|
290
281
|
}
|
|
@@ -324,7 +315,7 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
324
315
|
result += dateToStringWithCustomFormat(localizedDate, String.fromCharCode(nextChar), utc);
|
|
325
316
|
}
|
|
326
317
|
else {
|
|
327
|
-
throw new
|
|
318
|
+
throw new Exception("Invalid format string");
|
|
328
319
|
}
|
|
329
320
|
break;
|
|
330
321
|
case "\\":
|
|
@@ -334,7 +325,7 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
334
325
|
result += String.fromCharCode(nextChar2);
|
|
335
326
|
}
|
|
336
327
|
else {
|
|
337
|
-
throw new
|
|
328
|
+
throw new Exception("Invalid format string");
|
|
338
329
|
}
|
|
339
330
|
break;
|
|
340
331
|
default:
|
|
@@ -345,8 +336,8 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
345
336
|
}
|
|
346
337
|
return result;
|
|
347
338
|
}
|
|
348
|
-
export function
|
|
349
|
-
return value.kind
|
|
339
|
+
export function getKind(value) {
|
|
340
|
+
return value.kind ?? DateTimeKind.Unspecified;
|
|
350
341
|
}
|
|
351
342
|
export function unixEpochMillisecondsToTicks(ms, offset) {
|
|
352
343
|
return toInt64(((BigInt(ms) + 62135596800000n) + BigInt(offset)) * 10000n);
|
|
@@ -363,19 +354,13 @@ export function dateOffsetToString(offset) {
|
|
|
363
354
|
padWithZeros(hours, 2) + ":" +
|
|
364
355
|
padWithZeros(minutes, 2);
|
|
365
356
|
}
|
|
366
|
-
export function dateToHalfUTCString(date, half) {
|
|
367
|
-
const str = date.toISOString();
|
|
368
|
-
return half === "first"
|
|
369
|
-
? str.substring(0, str.indexOf("T"))
|
|
370
|
-
: str.substring(str.indexOf("T") + 1, str.length - 1);
|
|
371
|
-
}
|
|
372
357
|
function dateToISOString(d, utc) {
|
|
373
358
|
if (utc) {
|
|
374
359
|
return d.toISOString();
|
|
375
360
|
}
|
|
376
361
|
else {
|
|
377
362
|
// JS Date is always local
|
|
378
|
-
const printOffset = d.kind == null ? true : d.kind ===
|
|
363
|
+
const printOffset = d.kind == null ? true : d.kind === DateTimeKind.Local;
|
|
379
364
|
return padWithZeros(d.getFullYear(), 4) + "-" +
|
|
380
365
|
padWithZeros(d.getMonth() + 1, 2) + "-" +
|
|
381
366
|
padWithZeros(d.getDate(), 2) + "T" +
|
|
@@ -397,37 +382,127 @@ function dateToStringWithOffset(date, format) {
|
|
|
397
382
|
}
|
|
398
383
|
else if (format.length === 1) {
|
|
399
384
|
switch (format) {
|
|
400
|
-
case "D":
|
|
401
|
-
case "d": return
|
|
402
|
-
case "
|
|
403
|
-
case "
|
|
385
|
+
case "D": return dateToString_D(d);
|
|
386
|
+
case "d": return dateToString_d(d);
|
|
387
|
+
case "F": return dateToString_D(d) + " " + dateToString_T(d);
|
|
388
|
+
case "f": return dateToString_D(d) + " " + dateToString_t(d);
|
|
389
|
+
case "G": return dateToString_d(d) + " " + dateToString_T(d);
|
|
390
|
+
case "g": return dateToString_d(d) + " " + dateToString_t(d);
|
|
391
|
+
case "M":
|
|
392
|
+
case "m": return dateToString_M(d);
|
|
404
393
|
case "O":
|
|
405
394
|
case "o": return dateToISOStringWithOffset(d, (date.offset ?? 0));
|
|
406
|
-
|
|
395
|
+
case "R":
|
|
396
|
+
case "r": {
|
|
397
|
+
const utcDate = DateTime(date.getTime(), DateTimeKind.Utc);
|
|
398
|
+
return dateToString_R(utcDate);
|
|
399
|
+
}
|
|
400
|
+
case "s": return dateToString_s(toUniversalTime(d));
|
|
401
|
+
case "T": return dateToString_T(toUniversalTime(d));
|
|
402
|
+
case "t": return dateToString_t(toUniversalTime(d));
|
|
403
|
+
case "u": {
|
|
404
|
+
const utcDate = DateTime(date.getTime(), DateTimeKind.Utc);
|
|
405
|
+
return dateToString_u(utcDate);
|
|
406
|
+
}
|
|
407
|
+
case "U": {
|
|
408
|
+
const utcDate = DateTime(date.getTime(), DateTimeKind.Utc);
|
|
409
|
+
return dateToString_D(utcDate) + " " + dateToString_T(utcDate);
|
|
410
|
+
}
|
|
411
|
+
case "Y":
|
|
412
|
+
case "y": return dateToString_Y(d);
|
|
413
|
+
default: throw new Exception("Unrecognized Date print format");
|
|
407
414
|
}
|
|
408
415
|
}
|
|
409
416
|
else {
|
|
410
417
|
return dateToStringWithCustomFormat(d, format, true);
|
|
411
418
|
}
|
|
412
419
|
}
|
|
420
|
+
function dateToString_D(date) {
|
|
421
|
+
return longDays[dayOfWeek(date)]
|
|
422
|
+
+ ", " + padWithZeros(day(date), 2)
|
|
423
|
+
+ " " + longMonths[month(date) - 1]
|
|
424
|
+
+ " " + year(date);
|
|
425
|
+
}
|
|
426
|
+
function dateToString_d(date) {
|
|
427
|
+
return padWithZeros(month(date), 2)
|
|
428
|
+
+ "/" + padWithZeros(day(date), 2)
|
|
429
|
+
+ "/" + year(date);
|
|
430
|
+
}
|
|
431
|
+
function dateToString_T(date) {
|
|
432
|
+
return padWithZeros(hour(date), 2)
|
|
433
|
+
+ ":" + padWithZeros(minute(date), 2)
|
|
434
|
+
+ ":" + padWithZeros(second(date), 2);
|
|
435
|
+
}
|
|
436
|
+
function dateToString_t(date) {
|
|
437
|
+
return padWithZeros(hour(date), 2)
|
|
438
|
+
+ ":" + padWithZeros(minute(date), 2);
|
|
439
|
+
}
|
|
440
|
+
// RFC 1123: "Thu, 01 Jan 2009 00:00:00 GMT" — always UTC
|
|
441
|
+
function dateToString_R(date) {
|
|
442
|
+
const utcDate = toUniversalTime(date);
|
|
443
|
+
return shortDays[dayOfWeek(utcDate)] + ", "
|
|
444
|
+
+ padWithZeros(day(utcDate), 2) + " "
|
|
445
|
+
+ shortMonths[month(utcDate) - 1] + " "
|
|
446
|
+
+ year(utcDate) + " "
|
|
447
|
+
+ padWithZeros(hour(utcDate), 2) + ":"
|
|
448
|
+
+ padWithZeros(minute(utcDate), 2) + ":"
|
|
449
|
+
+ padWithZeros(second(utcDate), 2) + " GMT";
|
|
450
|
+
}
|
|
451
|
+
// Sortable ISO 8601, no timezone: "2009-06-15T13:45:30"
|
|
452
|
+
function dateToString_s(date) {
|
|
453
|
+
return padWithZeros(year(date), 4) + "-"
|
|
454
|
+
+ padWithZeros(month(date), 2) + "-"
|
|
455
|
+
+ padWithZeros(day(date), 2) + "T"
|
|
456
|
+
+ padWithZeros(hour(date), 2) + ":"
|
|
457
|
+
+ padWithZeros(minute(date), 2) + ":"
|
|
458
|
+
+ padWithZeros(second(date), 2);
|
|
459
|
+
}
|
|
460
|
+
// Universal sortable: "2009-06-15 13:45:30Z" — always UTC
|
|
461
|
+
function dateToString_u(date) {
|
|
462
|
+
const utcDate = toUniversalTime(date);
|
|
463
|
+
return padWithZeros(year(utcDate), 4) + "-"
|
|
464
|
+
+ padWithZeros(month(utcDate), 2) + "-"
|
|
465
|
+
+ padWithZeros(day(utcDate), 2) + " "
|
|
466
|
+
+ padWithZeros(hour(utcDate), 2) + ":"
|
|
467
|
+
+ padWithZeros(minute(utcDate), 2) + ":"
|
|
468
|
+
+ padWithZeros(second(utcDate), 2) + "Z";
|
|
469
|
+
}
|
|
470
|
+
// Month/day (InvariantCulture "MMMM dd"): "June 15"
|
|
471
|
+
function dateToString_M(date) {
|
|
472
|
+
return longMonths[month(date) - 1] + " " + padWithZeros(day(date), 2);
|
|
473
|
+
}
|
|
474
|
+
// Year/month (InvariantCulture "yyyy MMMM"): "2009 June"
|
|
475
|
+
function dateToString_Y(date) {
|
|
476
|
+
return year(date) + " " + longMonths[month(date) - 1];
|
|
477
|
+
}
|
|
413
478
|
function dateToStringWithKind(date, format) {
|
|
414
|
-
const utc = date.kind ===
|
|
479
|
+
const utc = date.kind === DateTimeKind.Utc;
|
|
415
480
|
if (typeof format !== "string") {
|
|
416
|
-
return
|
|
481
|
+
return dateToString_d(date) + " " + dateToString_T(date);
|
|
417
482
|
}
|
|
418
483
|
else if (format.length === 1) {
|
|
419
484
|
switch (format) {
|
|
420
|
-
case "D":
|
|
421
|
-
case "d":
|
|
422
|
-
|
|
423
|
-
case "
|
|
424
|
-
case "
|
|
425
|
-
|
|
485
|
+
case "D": return dateToString_D(date);
|
|
486
|
+
case "d": return dateToString_d(date);
|
|
487
|
+
case "F": return dateToString_D(date) + " " + dateToString_T(date);
|
|
488
|
+
case "f": return dateToString_D(date) + " " + dateToString_t(date);
|
|
489
|
+
case "G": return dateToString_d(date) + " " + dateToString_T(date);
|
|
490
|
+
case "g": return dateToString_d(date) + " " + dateToString_t(date);
|
|
491
|
+
case "M":
|
|
492
|
+
case "m": return dateToString_M(date);
|
|
426
493
|
case "O":
|
|
427
|
-
case "o":
|
|
428
|
-
|
|
494
|
+
case "o": return dateToISOString(date, utc);
|
|
495
|
+
case "R":
|
|
496
|
+
case "r": return dateToString_R(date);
|
|
497
|
+
case "s": return dateToString_s(date);
|
|
498
|
+
case "T": return dateToString_T(date);
|
|
499
|
+
case "t": return dateToString_t(date);
|
|
500
|
+
case "u": return dateToString_u(date);
|
|
501
|
+
case "U": return dateToString_D(toUniversalTime(date)) + " " + dateToString_T(toUniversalTime(date));
|
|
502
|
+
case "Y":
|
|
503
|
+
case "y": return dateToString_Y(date);
|
|
429
504
|
default:
|
|
430
|
-
throw new
|
|
505
|
+
throw new Exception("Unrecognized Date print format");
|
|
431
506
|
}
|
|
432
507
|
}
|
|
433
508
|
else {
|
|
@@ -441,24 +516,28 @@ export function toString(date, format, _provider) {
|
|
|
441
516
|
}
|
|
442
517
|
export function DateTime(value, kind) {
|
|
443
518
|
const d = new Date(value);
|
|
444
|
-
d.kind = (kind == null ?
|
|
519
|
+
d.kind = (kind == null ? DateTimeKind.Unspecified : kind);
|
|
445
520
|
return d;
|
|
446
521
|
}
|
|
447
522
|
export function fromTicks(ticks, kind) {
|
|
448
|
-
kind = kind != null ? kind :
|
|
523
|
+
kind = kind != null ? kind : DateTimeKind.Local; // better default than Unspecified
|
|
449
524
|
let date = DateTime(ticksToUnixEpochMilliseconds(ticks), kind);
|
|
450
525
|
// Ticks are local to offset (in this case, either UTC or Local/Unknown).
|
|
451
526
|
// If kind is anything but UTC, that means that the tick number was not
|
|
452
527
|
// in utc, thus getTime() cannot return UTC, and needs to be shifted.
|
|
453
|
-
if (kind !==
|
|
528
|
+
if (kind !== DateTimeKind.Utc) {
|
|
454
529
|
date = DateTime(date.getTime() - dateOffset(date), kind);
|
|
455
530
|
}
|
|
456
531
|
return date;
|
|
457
532
|
}
|
|
533
|
+
export function fromDateTime(dateOnly, timeOnly, kind) {
|
|
534
|
+
const d = DateTime(dateOnly.getTime() + timeOnly, kind);
|
|
535
|
+
return DateTime(d.getTime() - dateOffset(d), kind);
|
|
536
|
+
}
|
|
458
537
|
export function fromDateTimeOffset(date, kind) {
|
|
459
538
|
switch (kind) {
|
|
460
|
-
case
|
|
461
|
-
case
|
|
539
|
+
case DateTimeKind.Utc: return DateTime(date.getTime(), DateTimeKind.Utc);
|
|
540
|
+
case DateTimeKind.Local: return DateTime(date.getTime(), DateTimeKind.Local);
|
|
462
541
|
default:
|
|
463
542
|
const d = DateTime(date.getTime() + (date.offset ?? 0), kind);
|
|
464
543
|
return DateTime(d.getTime() - dateOffset(d), kind);
|
|
@@ -469,19 +548,33 @@ export function getTicks(date) {
|
|
|
469
548
|
}
|
|
470
549
|
export function minValue() {
|
|
471
550
|
// This is "0001-01-01T00:00:00.000Z", actual JS min value is -8640000000000000
|
|
472
|
-
return DateTime(-62135596800000,
|
|
551
|
+
return DateTime(-62135596800000, DateTimeKind.Utc);
|
|
473
552
|
}
|
|
474
553
|
export function maxValue() {
|
|
475
554
|
// This is "9999-12-31T23:59:59.999Z", actual JS max value is 8640000000000000
|
|
476
|
-
return DateTime(253402300799999,
|
|
477
|
-
}
|
|
555
|
+
return DateTime(253402300799999, DateTimeKind.Utc);
|
|
556
|
+
}
|
|
557
|
+
// The only date words .NET's invariant parser recognises: month names, weekday names,
|
|
558
|
+
// meridiem designators and zone markers (plus the ISO "T" separator). Anything else is
|
|
559
|
+
// rejected. Used to reject JS-permissive inputs (see `parseRaw`).
|
|
560
|
+
const recognizedDateWords = new Set([
|
|
561
|
+
"january", "february", "march", "april", "may", "june",
|
|
562
|
+
"july", "august", "september", "october", "november", "december",
|
|
563
|
+
"jan", "feb", "mar", "apr", "jun", "jul", "aug", "sep", "sept", "oct", "nov", "dec",
|
|
564
|
+
"monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday",
|
|
565
|
+
"mon", "tue", "wed", "thu", "fri", "sat", "sun",
|
|
566
|
+
"am", "pm", "gmt", "utc", "ut", "t", "z",
|
|
567
|
+
]);
|
|
478
568
|
export function parseRaw(input) {
|
|
479
569
|
function fail() {
|
|
480
|
-
throw new
|
|
570
|
+
throw new Exception(`The string is not a valid Date: ${input}`);
|
|
481
571
|
}
|
|
482
572
|
if (input == null || input.trim() === "") {
|
|
483
573
|
fail();
|
|
484
574
|
}
|
|
575
|
+
if ((input.match(/[a-z]+/gi) ?? []).some(word => !recognizedDateWords.has(word.toLowerCase()))) {
|
|
576
|
+
fail();
|
|
577
|
+
}
|
|
485
578
|
// ISO dates without TZ are parsed as UTC. Adding time without TZ keeps them local.
|
|
486
579
|
if (input.length === 10 && input[4] === "-" && input[7] === "-") {
|
|
487
580
|
input += "T00:00:00";
|
|
@@ -490,7 +583,6 @@ export function parseRaw(input) {
|
|
|
490
583
|
let offset = null;
|
|
491
584
|
if (isNaN(date.getTime())) {
|
|
492
585
|
// Try to check strings JS Date cannot parse (see #1045, #1422)
|
|
493
|
-
// tslint:disable-next-line:max-line-length
|
|
494
586
|
const m = /^\s*(\d+[^\w\s:]\d+[^\w\s:]\d+)?\s*(\d+:\d+(?::\d+(?:\.\d+)?)?)?\s*([AaPp][Mm])?\s*(Z|[+-]([01]?\d):?([0-5]?\d)?)?\s*$/.exec(input);
|
|
495
587
|
if (m != null) {
|
|
496
588
|
let baseDate;
|
|
@@ -503,7 +595,10 @@ export function parseRaw(input) {
|
|
|
503
595
|
parseInt(timeParts[1] || "0", 10) * 60 +
|
|
504
596
|
parseFloat(timeParts[2] || "0");
|
|
505
597
|
if (m[3] != null && m[3].toUpperCase() === "PM" && hourPart < 12) {
|
|
506
|
-
timeInSeconds +=
|
|
598
|
+
timeInSeconds += 12 * 3600;
|
|
599
|
+
}
|
|
600
|
+
else if (m[3] != null && m[3].toUpperCase() === "AM" && hourPart === 12) {
|
|
601
|
+
timeInSeconds -= 12 * 3600;
|
|
507
602
|
}
|
|
508
603
|
}
|
|
509
604
|
if (m[4] != null) { // There's an offset, parse as UTC
|
|
@@ -554,8 +649,8 @@ export function parse(str, detectUTC = false) {
|
|
|
554
649
|
// .NET always parses DateTime as Local if there's offset info (even "Z")
|
|
555
650
|
// Newtonsoft.Json uses UTC if the offset is "Z"
|
|
556
651
|
const kind = offset != null
|
|
557
|
-
? (detectUTC && offset === "Z" ?
|
|
558
|
-
:
|
|
652
|
+
? (detectUTC && offset === "Z" ? DateTimeKind.Utc : DateTimeKind.Local)
|
|
653
|
+
: DateTimeKind.Unspecified;
|
|
559
654
|
return DateTime(date.getTime(), kind);
|
|
560
655
|
}
|
|
561
656
|
export function tryParse(v, defValue) {
|
|
@@ -568,11 +663,11 @@ export function tryParse(v, defValue) {
|
|
|
568
663
|
}
|
|
569
664
|
}
|
|
570
665
|
export function create(year, month, day, h = 0, m = 0, s = 0, ms = 0, kind) {
|
|
571
|
-
const date = kind ===
|
|
666
|
+
const date = kind === DateTimeKind.Utc
|
|
572
667
|
? new Date(Date.UTC(year, month - 1, day, h, m, s, ms))
|
|
573
668
|
: new Date(year, month - 1, day, h, m, s, ms);
|
|
574
669
|
if (year <= 99) {
|
|
575
|
-
if (kind ===
|
|
670
|
+
if (kind === DateTimeKind.Utc) {
|
|
576
671
|
date.setUTCFullYear(year, month - 1, day);
|
|
577
672
|
}
|
|
578
673
|
else {
|
|
@@ -581,15 +676,15 @@ export function create(year, month, day, h = 0, m = 0, s = 0, ms = 0, kind) {
|
|
|
581
676
|
}
|
|
582
677
|
const dateValue = date.getTime();
|
|
583
678
|
if (isNaN(dateValue)) {
|
|
584
|
-
throw new
|
|
679
|
+
throw new Exception("The parameters describe an unrepresentable Date.");
|
|
585
680
|
}
|
|
586
681
|
return DateTime(dateValue, kind);
|
|
587
682
|
}
|
|
588
683
|
export function now() {
|
|
589
|
-
return DateTime(Date.now(),
|
|
684
|
+
return DateTime(Date.now(), DateTimeKind.Local);
|
|
590
685
|
}
|
|
591
686
|
export function utcNow() {
|
|
592
|
-
return DateTime(Date.now(),
|
|
687
|
+
return DateTime(Date.now(), DateTimeKind.Utc);
|
|
593
688
|
}
|
|
594
689
|
export function today() {
|
|
595
690
|
return date(now());
|
|
@@ -603,10 +698,10 @@ export function daysInMonth(year, month) {
|
|
|
603
698
|
: (month >= 8 ? (month % 2 === 0 ? 31 : 30) : (month % 2 === 0 ? 30 : 31));
|
|
604
699
|
}
|
|
605
700
|
export function toUniversalTime(date) {
|
|
606
|
-
return date.kind ===
|
|
701
|
+
return date.kind === DateTimeKind.Utc ? date : DateTime(date.getTime(), DateTimeKind.Utc);
|
|
607
702
|
}
|
|
608
703
|
export function toLocalTime(date) {
|
|
609
|
-
return date.kind ===
|
|
704
|
+
return date.kind === DateTimeKind.Local ? date : DateTime(date.getTime(), DateTimeKind.Local);
|
|
610
705
|
}
|
|
611
706
|
export function specifyKind(d, kind) {
|
|
612
707
|
return create(year(d), month(d), day(d), hour(d), minute(d), second(d), millisecond(d), kind);
|
|
@@ -621,28 +716,28 @@ export function date(d) {
|
|
|
621
716
|
return create(year(d), month(d), day(d), 0, 0, 0, 0, d.kind);
|
|
622
717
|
}
|
|
623
718
|
export function day(d) {
|
|
624
|
-
return d.kind ===
|
|
719
|
+
return d.kind === DateTimeKind.Utc ? d.getUTCDate() : d.getDate();
|
|
625
720
|
}
|
|
626
721
|
export function hour(d) {
|
|
627
|
-
return d.kind ===
|
|
722
|
+
return d.kind === DateTimeKind.Utc ? d.getUTCHours() : d.getHours();
|
|
628
723
|
}
|
|
629
724
|
export function millisecond(d) {
|
|
630
|
-
return d.kind ===
|
|
725
|
+
return d.kind === DateTimeKind.Utc ? d.getUTCMilliseconds() : d.getMilliseconds();
|
|
631
726
|
}
|
|
632
727
|
export function minute(d) {
|
|
633
|
-
return d.kind ===
|
|
728
|
+
return d.kind === DateTimeKind.Utc ? d.getUTCMinutes() : d.getMinutes();
|
|
634
729
|
}
|
|
635
730
|
export function month(d) {
|
|
636
|
-
return (d.kind ===
|
|
731
|
+
return (d.kind === DateTimeKind.Utc ? d.getUTCMonth() : d.getMonth()) + 1;
|
|
637
732
|
}
|
|
638
733
|
export function second(d) {
|
|
639
|
-
return d.kind ===
|
|
734
|
+
return d.kind === DateTimeKind.Utc ? d.getUTCSeconds() : d.getSeconds();
|
|
640
735
|
}
|
|
641
736
|
export function year(d) {
|
|
642
|
-
return d.kind ===
|
|
737
|
+
return d.kind === DateTimeKind.Utc ? d.getUTCFullYear() : d.getFullYear();
|
|
643
738
|
}
|
|
644
739
|
export function dayOfWeek(d) {
|
|
645
|
-
return d.kind ===
|
|
740
|
+
return d.kind === DateTimeKind.Utc ? d.getUTCDay() : d.getDay();
|
|
646
741
|
}
|
|
647
742
|
export function dayOfYear(d) {
|
|
648
743
|
const _year = year(d);
|
|
@@ -655,7 +750,7 @@ export function dayOfYear(d) {
|
|
|
655
750
|
}
|
|
656
751
|
export function add(d, ts) {
|
|
657
752
|
const newDate = DateTime(d.getTime() + ts, d.kind);
|
|
658
|
-
if (d.kind
|
|
753
|
+
if (d.kind !== DateTimeKind.Utc) {
|
|
659
754
|
const oldTzOffset = d.getTimezoneOffset();
|
|
660
755
|
const newTzOffset = newDate.getTimezoneOffset();
|
|
661
756
|
return oldTzOffset !== newTzOffset
|
|
@@ -692,19 +787,9 @@ export function addYears(d, v) {
|
|
|
692
787
|
return create(newYear, newMonth, newDay, hour(d), minute(d), second(d), millisecond(d), d.kind);
|
|
693
788
|
}
|
|
694
789
|
export function addMonths(d, v) {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
if (newMonth > 12) {
|
|
699
|
-
newMonth_ = newMonth % 12;
|
|
700
|
-
yearOffset = Math.floor(newMonth / 12);
|
|
701
|
-
newMonth = newMonth_;
|
|
702
|
-
}
|
|
703
|
-
else if (newMonth < 1) {
|
|
704
|
-
newMonth_ = 12 + newMonth % 12;
|
|
705
|
-
yearOffset = Math.floor(newMonth / 12) + (newMonth_ === 12 ? -1 : 0);
|
|
706
|
-
newMonth = newMonth_;
|
|
707
|
-
}
|
|
790
|
+
const totalMonths = month(d) + v;
|
|
791
|
+
const newMonth = ((totalMonths - 1) % 12 + 12) % 12 + 1;
|
|
792
|
+
const yearOffset = Math.floor((totalMonths - 1) / 12);
|
|
708
793
|
const newYear = year(d) + yearOffset;
|
|
709
794
|
const _daysInMonth = daysInMonth(newYear, newMonth);
|
|
710
795
|
const newDay = Math.min(_daysInMonth, day(d));
|