@@ -148,6 +148,40 @@ module Core =
148148 let tryParseFloatInvariant = tryParseFloatPlatformInvariant
149149 let tryParseDecimalInvariant = tryParseDecimalPlatformInvariant
150150
151+ ///
152+ /// Fable's packaged ` fable-library-js ` surface does not currently expose the
153+ /// ` ParseExact ` helpers for date/time types, so the shared schemas need one
154+ /// portable entry point that preserves exact parsing on .NET and compatible
155+ /// parsing on Fable.
156+ let parseDateTimeRoundtripInvariant ( text : string ) =
157+ #if FABLE_ COMPILER
158+ System.DateTime.Parse( text)
159+ #else
160+ System.DateTime.ParseExact( text, " O" , CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind)
161+ #endif
162+
163+ ///
164+ /// The package consumer path exercises the published Fable runtime rather
165+ /// than the local source build, so ` DateTimeOffset ` parsing needs the same
166+ /// fallback to avoid importing helpers that the package does not ship.
167+ let parseDateTimeOffsetRoundtripInvariant ( text : string ) =
168+ #if FABLE_ COMPILER
169+ System.DateTimeOffset.Parse( text)
170+ #else
171+ System.DateTimeOffset.ParseExact( text, " O" , CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind)
172+ #endif
173+
174+ ///
175+ /// ` TimeSpan.ParseExact ` hits the same missing-helper problem under Fable,
176+ /// while plain invariant parsing still accepts the canonical ` "c" ` payloads
177+ /// that the encoder emits.
178+ let parseTimeSpanConstantInvariant ( text : string ) =
179+ #if FABLE_ COMPILER
180+ System.TimeSpan.Parse( text)
181+ #else
182+ System.TimeSpan.ParseExact( text, " c" , CultureInfo.InvariantCulture)
183+ #endif
184+
151185 let private failIntegerToken typeName allowMinus token =
152186 match classifyIntegerToken allowMinus token with
153187 | OutOfRangeToken -> failwithf " %s value out of range: %s " typeName token
0 commit comments