Giter Club home page Giter Club logo

timezone's People

Contributors

lzorglub avatar

Stargazers

 avatar

Watchers

 avatar  avatar

timezone's Issues

Incorrect values for at least some zones

I was trying to investigate an issue reported here: http://mm.icann.org/pipermail/tz/2018-July/026698.html

I decided to implement a tzvalidate dump for Afk.TimeZone, but in doing so I found a problem that it's hard to get past.

The "America/Argentina/Buenos_Aires" time zone seems to get "stuck" for at least some time at 1998-12-31T23:56:15Z. Here's a program to demonstrate:

using System;
using System.Linq;
using Afk.ZoneInfo;

class Program
{
    static void Main(string[] args)
    {
        var zone = TzTimeInfo.GetZones().Single(z => z.Name == "America/Argentina/Buenos_Aires");
        
        var start = new DateTime(1998, 12, 31, 23, 56, 15, DateTimeKind.Utc);
        
        for (int i = 0; i < 10; i++)
        {
            Console.WriteLine(zone.ToLocalTime(start.AddTicks(i)).Ticks);
        }
    }
}

The output is:

630507345750000000
630507345750000000
630507345750000000
630507345750000000
630507345750000000
630507345750000000
630507345750000000
630507345750000000
630507345750000000
630507345750000000

That basically suggests that the wall clock stands still for at least those 10 ticks, which shouldn't happen.

I'm going to try to hard-code a workaround for this to start with, but it's not clear whether that will be sufficient.

Bug in optimized algorithm

Values provided for America/Grand_Turk year 2018 are incorrect.
The optimized algorithm (prefetch of DST changes) retrieve the wrong DST value.

Version 2.2 use now by default the normal algorithm before fix.

Can't use updated files from IANA

When I download the files manually, I get an exception. "The type initializer for 'Afk.ZoneInfo.TzTimeInfo' threw an exception."

I looked at it a little in the debugger and it seems there is some duplicate key error. BTW, it seems that it happens even with the current files. I copied the current files in the data folder to another folder and defined that folder in the env var TZDIR and the same thing happens.

Just to be clear, I just download https://www.iana.org/time-zones/repository/tzdata-latest.tar.gz and unpack it into a directory. That is my TZDIR.

"Iran Standard Time" conversion issue

For some dates,when i convert local tome to utc and reverse utc to local,then local dates aren't same.
this is my test that reproduce the bug:

       [TestMethod]
       public void ToUtcAndReverse()
       {
           var timeZoneProvider = new AfkTimeZoneProvider();
           const string IranStandardTime = "Iran Standard Time";

           var errors = new List<string>();
           var currentDate = new DateTime(1940, 1, 1);
           var maxDate = new DateTime(2040, 1, 1);

           for (var i = 1; i < 10000000; i++)
           {
               var utcDate = timeZoneProvider.ToUtc(currentDate, IranStandardTime);

               var localDate = timeZoneProvider.ToLocal(utcDate, IranStandardTime);


               if (currentDate.Date != localDate.Date)
               {
                   errors.Add(currentDate.ToLongDateString());
               }

               currentDate = currentDate.AddDays(1);

               
               if (currentDate > maxDate)
               {
                   break;
               }
           }

           if (errors.Any())
           {
               Assert.Fail();
           }
       }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.