microsoft / microsoft/AdaptiveCards

[Rendering] [UWP] DateInputRenderer - Time calculation bug

Open
#6,900 1 comment 0 reactions 1 assignee View on GitHub

@beervoley is already working on this.

Since Jan 24, 2022.

Area-Renderers Bug Platform-XAML
Dominant language
C#
Stars
2k
Forks
595
Avg merge
1d 19h
Merged PRs (30d)
1

Description

Target Platforms

UWP

SDK Version

3.0.2

Application Name

N/A

Problem Description

AdaptiveDateInputRenderer has a capability to parse date in various format from the string parameter. This parameter can include time of the day besides year, month and day.
Function GetDateTime that's being used to convert that time to local time is not taking into account the tiem of day when converting. It can result in incorrect time calculation if the timezone is ahead of UTC by certain amount (need to investigate).

winrt::DateTime GetDateTime(unsigned int year, unsigned int month, unsigned int day)
{
    // TODO: investigate the midnight bug. If the timezone will be ahead of UTC we can do -1 day when converting
    SYSTEMTIME systemTime = {(WORD)year, (WORD)month, 0, (WORD)day};

    // Convert to UTC
    TIME_ZONE_INFORMATION timeZone;
    GetTimeZoneInformation(&timeZone);
    TzSpecificLocalTimeToSystemTime(&timeZone, &systemTime, &systemTime);

    // Convert to ticks
    FILETIME fileTime;
    SystemTimeToFileTime(&systemTime, &fileTime);

    return winrt::clock::from_FILETIME({fileTime});
}
Screenshots

No response

Card JSON
N/A
Sample Code Language

No response

Sample Code

No response

Contributor guide

Open the contributing guide

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.