Skip to content

JsonStringTests.TestDateTimeOffset test failure #31166

Closed
dotnet/corefx
#41940

Description

@tmds

This test failed on my machine for dateTime: 0001-01-01T00:00:00.0000000Z:

      <test name="System.Text.Json.Tests.JsonStringTests.TestDateTimeOffset(dateTime: 0001-01-01T00:00:00.0000000Z)" type="System.Text.Json.Tests.JsonStringTests" method="TestDateTimeOffset" time="0.0904563" result="Fail">
        <failure exception-type="System.FormatException">
          <message><![CDATA[System.FormatException : The UTC representation of the date '0001-01-01T00:00:00' falls outside the year range 1-9999.]]></message>
          <stack-trace><![CDATA[   at System.DateTimeParse.ParseExact(ReadOnlySpan`1 s, ReadOnlySpan`1 format, DateTimeFormatInfo dtfi, DateTimeStyles style, TimeSpan& offset) in /_/src/System.Private.CoreLib/shared/System/Globalization/DateTimeParse.cs:line 46
   at System.DateTimeOffset.ParseExact(String input, String format, IFormatProvider formatProvider, DateTimeStyles styles) in /_/src/System.Private.CoreLib/shared/System/DateTimeOffset.cs:line 542
   at System.DateTimeOffset.ParseExact(String input, String format, IFormatProvider formatProvider) in /_/src/System.Private.CoreLib/shared/System/DateTimeOffset.cs:line 528
   at System.Text.Json.Tests.JsonStringTests.TestDateTimeOffset(DateTime dateTime) in /home/tmds/repos/corefx/src/System.Text.Json/tests/JsonStringTests.cs:line 112]]></stack-trace>
        </failure>
      </test>

Activity

  1. layomia commented on Oct 18, 2019

    @layomia
    Contributor
  2. khellang commented on Oct 21, 2019

    @khellang
    Member

    @layomia I'm getting the same locally:

    image

    image

  3. tmds commented on Oct 21, 2019

    @tmds
    MemberAuthor
    $ timedatectl
                   Local time: Mon 2019-10-21 10:46:09 CEST
               Universal time: Mon 2019-10-21 08:46:09 UTC
                     RTC time: Mon 2019-10-21 10:46:09
                    Time zone: Europe/Paris (CEST, +0200)
    System clock synchronized: yes
                  NTP service: active
              RTC in local TZ: yes
    
    Warning: The system is configured to read the RTC time in the local time zone.
             This mode cannot be fully supported. It will create various problems
             with time zone changes and daylight saving time adjustments. The RTC
             time is never updated, it relies on external facilities to maintain it.
             If at all possible, use RTC in UTC by calling
             'timedatectl set-local-rtc 0'.
    
    $ readlink /etc/localtime 
    ../usr/share/zoneinfo/Europe/Paris
    
    $ cat /etc/timezone
    cat: /etc/timezone: No such file or directory
    
  4. transferred this issue fromdotnet/corefxon Feb 1, 2020
  5. added this to the 5.0 milestone on Feb 1, 2020
  6. ghost locked as resolved and limited conversation to collaborators on Dec 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions