Skip to content

Fix ParseDate to handle non-strict ISO 8601 date formats from connectors#3048

Open
EricBuist wants to merge 3 commits intomicrosoft:mainfrom
EricBuist:users/ericbuist/datetime-parsing-fix
Open

Fix ParseDate to handle non-strict ISO 8601 date formats from connectors#3048
EricBuist wants to merge 3 commits intomicrosoft:mainfrom
EricBuist:users/ericbuist/datetime-parsing-fix

Conversation

@EricBuist
Copy link
Copy Markdown
Contributor

ParseDate used element.GetDateTime() which only accepts strict ISO 8601. Connector APIs like Jira return valid dates with timezone offsets without colons (e.g. "+0000" instead of "+00:00") that GetDateTime() rejects. Now falls back to DateTimeOffset.TryParse on FormatException, and returns an ErrorValue instead of throwing if both parsers fail.

ParseDate used element.GetDateTime() which only accepts strict ISO 8601.
Connector APIs like Jira return valid dates with timezone offsets without
colons (e.g. "+0000" instead of "+00:00") that GetDateTime() rejects.
Now falls back to DateTimeOffset.TryParse on FormatException, and returns
an ErrorValue instead of throwing if both parsers fail.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@EricBuist EricBuist requested a review from a team as a code owner April 2, 2026 18:03
@EricBuist
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 3048 in repo microsoft/Power-Fx

EricBuist and others added 2 commits April 13, 2026 10:28
…avior

Align DateTimeOffset.TryParse fallback with SwaggerTypeFormatExtensions'
ConvertToDate/ConvertToDatetime, which use DateTimeStyles.AssumeUniversal
so that date strings without timezone info are treated as UTC.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces the GetDateTime-with-fallback logic in FormulaValueJSON.ParseDate
with a single DateTimeOffset.TryParse(AssumeUniversal) call. This removes
the two-path inconsistency where strict and lenient inputs could differ in
how the stored instant was derived, and aligns no-offset inputs with Power
Automate / Logic Apps semantics (treated as UTC rather than literal local
wall-clock time). Updates PrimitivesTest to express its expected value as
the local-time projection of the UTC instant so it remains machine-stable.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant