igor-tkachev / bltoolkit

Business Logic Toolkit for .NET
MIT License
297 stars 112 forks source link

How to implement Converter DateTime with TimeZone #377

Closed b0bi79 closed 8 years ago

b0bi79 commented 8 years ago

The model has a field DateTimeOffset and TimeZone. Is it possible to implement a converter that will convert DateTimeOffset to DateTime considering TimeZone? In BLToolkit I have been implemented MemberMapper as follows:

    public override object GetValue(object o)
    {
        var dtoffset = (DateTimeOffset) base.GetValue(o);
        var pos = (PosInfo)o;
        return dtoffset > MinDate ? DateTimeHelper.ConvertToUtc(dtoffset, Tz.GetShopTimeZone(pos.shopNum)) : MinDate; 
    }
ili commented 8 years ago

think it goes to linq2db