public Func <WorkContext, T> Get <T>(string name)
 {
     if (name == "CurrentCalendar")
     {
         return(ctx => (T)(object)_calendarManager.GetCurrentCalendar(ctx.HttpContext));
     }
     return(null);
 }
Ejemplo n.º 2
0
        public async Task <DateTimeOffset> ConvertToLocalAsync(DateTimeOffset dateTimeOffSet)
        {
            var localTimeZone = await GetLocalTimeZoneAsync();

            var dateTimeZone    = ((TimeZone)localTimeZone).DateTimeZone;
            var offsetDateTime  = OffsetDateTime.FromDateTimeOffset(dateTimeOffSet);
            var currentCalendar = BclCalendars.GetCalendarByName(await _calendarManager.GetCurrentCalendar());

            return(offsetDateTime.InZone(dateTimeZone).WithCalendar(currentCalendar).ToDateTimeOffset());
        }