curiosity-ai / h5

🚀 The next generation C# to JavaScript compiler

Home Page:https://h5.rocks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong logic of DateTime.SpecifyKind

Ali1Jamal opened this issue · comments

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);