Conversation
…rovider Adds a new PreferDateTimeOffset static parameter (default: false) to CsvProvider, JsonProvider, and XmlProvider. When set to true, date-time values that would normally be inferred as DateTime are instead inferred as DateTimeOffset (using the local UTC offset). Values that already parse with an explicit timezone offset are already inferred as DateTimeOffset regardless of this parameter. This addresses the long-standing request in #1100 (configure default DateTimeKind for dates without timezone) and #1072 (control over timezone in CSV date writing). Closes #1100 Closes #1072 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 tasks
dsyme
approved these changes
Feb 26, 2026
dsyme
approved these changes
Feb 26, 2026
…fset-8d64eb68853e49f4
dsyme
reviewed
Feb 26, 2026
|
|
||
| /// Replaces DateTime → DateTimeOffset throughout an InferedType tree. | ||
| /// Used when PreferDateTimeOffset=true to infer all date-time values as DateTimeOffset. | ||
| let internal upgradeToDateTimeOffset (inferedType: InferedType) : InferedType = |
Contributor
There was a problem hiding this comment.
I'm not a fan of this approach, we should really be plumbing these flags down into inference and making the conversions at the leaves rather than patching things up afterwards
dsyme
reviewed
Feb 26, 2026
| t | ||
| else | ||
| StructuralInference.downgradeNet6Types t | ||
| if preferDateOnly && ProviderHelpers.runtimeSupportsNet6Types cfg.RuntimeAssembly then |
Contributor
There was a problem hiding this comment.
This way of doing PreferDateOnly needs some work. Since PreferDateOnly is not the default, we should not be introducing DateOnly only to remove them again
We should clean this up in main before taking this feature
…fset-8d64eb68853e49f4
Contributor
|
/repo-assist Update the docs |
…XmlProvider, and TypeInference docs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Commit pushed:
|
Contributor
Author
|
🤖 This is an automated response from Repo Assist. I've added documentation for
|
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 is an automated pull request from Repo Assist, an AI assistant for this repository.
Adds a
PreferDateTimeOffsetstatic parameter (default:false) toCsvProvider,JsonProvider, andXmlProvider, addressing the long-standing requests in #1100 and #1072.Closes #1100
Closes #1072
What this does
When
PreferDateTimeOffset=true, all date-time columns/fields that would normally be inferred asDateTimeare instead inferred asDateTimeOffset. Values already containing an explicit timezone offset (e.g.,"2023-06-15T10:30:00+05:30") are already inferred asDateTimeOffsetregardless of this flag.Implementation
The change is a post-inference rewrite: after structural type inference, a tree-walking transform replaces
DateTime→DateTimeOffsetthroughout the inferred type. No runtime changes are needed becauseTextRuntime.ConvertDateTimeOffsetalready has a fallback path that convertsDateTime-like strings toDateTimeOffsetusing the local offset.Files changed
StructuralInference.fs: Two new internal helpers:upgradeToDateTimeOffset— walks anInferedTypetree, replacingDateTime→DateTimeOffsetupgradeToDateTimeOffsetPrimitiveProperty— CSV-specific version forPrimitiveInferedPropertyCsvProvider.fs: NewPreferDateTimeOffsetstatic parameter (index 20); upgrade applied after the net6/DateOnly downgrade stepJsonProvider.fs: NewPreferDateTimeOffsetstatic parameter (index 15); upgrade applied after the net6/DateOnly downgrade stepXmlProvider.fs: NewPreferDateTimeOffsetstatic parameter (index 14); upgrade applied after the net6/DateOnly downgrade stepTypeProviderInstantiation.fs:PreferDateTimeOffsetfield added toCsvProviderArgs,XmlProviderArgs,JsonProviderArgsRELEASE_NOTES.md: UpdatedTest Status
FSharp.Data.DesignTimebuilds (netstandard2.0 + net8.0)mainunrelated to this PR (verified by running tests on unmodifiedmainwith same result)Notes
CsvProvider,JsonProvider, andXmlProviderare covered (HtmlProvider uses a different internal path that can be added in a follow-up)PreferDateTimeOffsetandPreferDateOnlyare orthogonal:DateOnlyvalues stay asDateOnlyeven whenPreferDateTimeOffset=truefalsefor full backward compatibilityWarning
The following domain was blocked by the firewall during workflow execution:
www.google.com