microsoft / microsoft/Power-Fx

DateTime format issue in HttpFunctionInvoker

Open
#2,880 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.4k
Forks
358
Avg merge
10h 34m
Merged PRs (30d)
3

Description

When connector expect a date-time type parameters in the query. They expected a UTC format.
{
"name": "startTime",
"in": "query",
"x-ms-summary": "From Start Time",
"description": "yyyy-MM-ddTHH:mm:ss.fffZ (UTC format)",
"required": false,
"x-ms-visibility": "advanced",
"type": "string",
"format": "date-time",
"x-ms-test-value": "2017-07-23T07:00:00Z"
}

But current paramValue?.ToObject()?.ToString() will generate a format like "3/31/2025 2:15:42 PM". which cause error in connector server side.

Ideally, we should reuse use _writer.WriteStringValue(dateTimeValue.ToString(UtcDateTimeFormat, CultureInfo.InvariantCulture));

Linked workitem: DateTime type mismatch

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/libraries/Microsoft.PowerFx.Connectors/Execution/HttpFunctionInvoker.cs at the parameter conversion linked in the issue, then compare it with OpenApiJsonSerializer.cs and its UTC date-time formatting. Done means date-time query parameters are serialized in the expected UTC format instead of the culture-dependent string shown in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.