Conversation
- Multi-target library projects to netstandard2.0;net8.0 to enable NET6_0_OR_GREATER conditional compilation - Add AsDateOnly/AsTimeOnly to TextConversions with guards against datetime strings being accepted by DateOnly/TimeOnly parsers - Add DateOnly to automatic type inference (matchValue); TimeOnly is NOT auto-inferred (ambiguous with TimeSpan) but available via explicit schema annotation (dateonly?/timeonly? in CSV headers) - Add DateOnly as subtype of DateTime in conversionTable; columns with mixed DateOnly+DateTime values unify to DateTime - Add ConvertDateOnly/ConvertTimeOnly to TextRuntime and JsonRuntime - Add DateOnly/TimeOnly cases to StructuralTypes, ConversionsGenerator, JsonConversionsGenerator, JsonConversions, JsonRuntime, CsvInference - Update tests for new DateOnly inference behaviour Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Feb 22, 2026
dsyme
reviewed
Feb 22, 2026
Contributor
Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Docs: Update CsvProvider and JsonProvider for DateOnly/TimeOnly inference
Contributor
|
@copilot There is a problem in the design time tests:
See failing CI run |
Contributor
…gets Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
[WIP] Add DateOnly and TimeOnly inference support
dsyme
approved these changes
Feb 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant for this repository.
Closes #1461Summary
Adds
DateOnlyandTimeOnlysupport to FSharp.Data's type inference pipeline, as requested by @dsyme in issue #1461.Changes
Multi-targeting
All library projects now target
netstandard2.0;net8.0(previouslynetstandard2.0only). This is required for#if NET6_0_OR_GREATERguards to activate in library code.Automatic
DateOnlyinference"2022-06-11"are now inferred asDateOnlyon .NET 6+ targets.DateOnlyis a subtype ofDateTimein the type hierarchy — columns mixingDateOnlyandDateTimevalues unify toDateTime(no breaking change for mixed columns).AsDateOnlyguards against theDateOnly.TryParsegotcha:DateOnly.TryParse("2022-06-12T01:02:03")returnstrue(ignores the time component). The fix checks for non-zeroTimeOfDayafter a successful parse and returnsNonein that case.TimeOnly— explicit annotation onlyTimeOnlyis not automatically inferred from string values. The string"00:30:00"is valid both asTimeOnlyandTimeSpan, making automatic inference ambiguous and a breaking change for existing code.TimeOnlyis available via explicit column annotation (timeonly?ortimeonly optionin CSV column headers / XML/JSON schema).TimeOnlyruntime methods (AsTimeOnly,ConvertTimeOnly, etc.) are present.AsTimeOnlyguards against the same gotcha asAsDateOnly:TimeOnly.TryParse("2016-10-05T04:05:03")returnstrue.Files changed
**/FSharp.Data*.fsproj(5 files)netstandard2.0→netstandard2.0;net8.0TextConversions.fsAsDateOnly,AsTimeOnlywith datetime-string guardsTextRuntime.fsConvertDateOnly,ConvertTimeOnly, back-conversion methodsStructuralTypes.fsDateOnly,TimeOnlycases inInferedTypeTagDUStructuralInference.fsDateOnlyinprimitiveTypes,typeTag,conversionTable,nameToType,matchValue;TimeOnlyinnameToTypeonlyConversionsGenerator.fsDateOnly/TimeOnlyquotation branchesJsonConversionsGenerator.fsDateOnly/TimeOnlyquotation branchesJsonConversions.fsAsDateOnly,AsTimeOnlyJsonRuntime.fsConvertDateOnly,ConvertTimeOnly, match casesCsvInference.fsdateonly?,timeonly?,dateonly option,timeonly optionschema namesDateTime→DateOnlyfor date-only valuesDesign decisions
AsDateOnlyis tried beforeAsDateTimeso pure date strings resolve toDateOnly.AsDateTimeOffsetis tried first (unchanged).DateOnly ⊆ DateTime,TimeOnly ⊆ TimeSpan. Mixed columns behave the same as before.Test Status
dotnet build FSharp.Data.sln -c Release -maxcpucount:1— succeededWarning
The following domain was blocked by the firewall during workflow execution:
www.google.com