curiosity-ai / h5

🚀 The next generation C# to JavaScript compiler
https://github.com/curiosity-ai/h5
Apache License 2.0
224 stars 31 forks source link

Wrong logic of DateTime.SpecifyKind #54

Open Ali1Jamal opened 3 years ago

Ali1Jamal commented 3 years ago

Steps To Reproduce https://dev.deck.net/9d292f241ded3180d8118d9bdb1e4edd

public class Program
{
    public static void Main()
    {
             DateTime date = DateTime.SpecifyKind(DateTime.Today, DateTimeKind.Utc);

            Console.WriteLine(date.ToString("u"));
    }
}

to compare: https://dev.deck.net/4916fff18f204ff5d2e171dfbd1cbde9

Expected Result 2019-08-05 00:00:00Z Actual Result

// Depending on time zone
UTC+1 - 2019-08-04 23:00:00Z
UTC+2 - 2019-08-04 22:00:00Z
etc

i think to fix this issues by change this line : https://github.com/theolivenbaum/h5/blob/d9c8a733e6b55584c3bd37b1f461ae9378882550/H5/H5/shared/System/DateTime.cs#L734 with this : return new DateTime(value.Ticks, kind);