private static DateTimeOffset AddByDate(DateTimeOffset dateTimeOffset, Func <DateTime, DateTime> operation, TimeZoneInfo timeZone, TimeZoneOffsetResolver resolver)
        {
            var dto = TimeZoneInfo.ConvertTime(dateTimeOffset, timeZone);
            var dt  = operation.Invoke(dto.DateTime);

            return(resolver.Invoke(dt, timeZone));
        }
Exemplo n.º 2
0
        public static DateTimeOffset Add(this DateTime dateTime, TimeSpan timeSpan, TimeZoneInfo timeZone, TimeZoneOffsetResolver resolver)
        {
            var dto    = resolver.Invoke(dateTime, timeZone);
            var result = dto.Add(timeSpan);

            return(TimeZoneInfo.ConvertTime(result, timeZone));
        }
Exemplo n.º 3
0
        public static DateTimeOffset Add(this DateTime dateTime, TimeSpan timeSpan, TimeZoneInfo timeZone, TimeZoneOffsetResolver resolver)
        {
            var utc = dateTime.Kind == DateTimeKind.Unspecified
                ? resolver.Invoke(dateTime, timeZone).UtcDateTime
                : dateTime.ToUniversalTime();

            var dt = utc.Add(timeSpan);
            return TimeZoneInfo.ConvertTime(dt, timeZone);
        }
Exemplo n.º 4
0
        public static DateTimeOffset Add(this DateTime dateTime, TimeSpan timeSpan, TimeZoneInfo timeZone, TimeZoneOffsetResolver resolver)
        {
            var utc = dateTime.Kind == DateTimeKind.Unspecified
                ? resolver.Invoke(dateTime, timeZone).UtcDateTime
                : dateTime.ToUniversalTime();

            var dt = utc.Add(timeSpan);

            return(TimeZoneInfo.ConvertTime(dt, timeZone));
        }
Exemplo n.º 5
0
        private static DateTimeOffset AddByDate(DateTime dateTime, Func <DateTime, DateTime> operation, TimeZoneInfo timeZone, TimeZoneOffsetResolver resolver)
        {
            if (dateTime.Kind != DateTimeKind.Unspecified)
            {
                dateTime = TimeZoneInfo.ConvertTime(dateTime, timeZone);
            }

            var result = operation.Invoke(dateTime);

            return(resolver.Invoke(result, timeZone));
        }
Exemplo n.º 6
0
 private static DateTimeOffset AddByDate(DateTimeOffset dateTimeOffset, Func<DateTime, DateTime> operation, TimeZoneInfo timeZone, TimeZoneOffsetResolver resolver)
 {
     var dto = TimeZoneInfo.ConvertTime(dateTimeOffset, timeZone);
     var dt = operation.Invoke(dto.DateTime);
     return resolver.Invoke(dt, timeZone);
 }
Exemplo n.º 7
0
        private static DateTimeOffset AddByDate(DateTime dateTime, Func<DateTime, DateTime> operation, TimeZoneInfo timeZone, TimeZoneOffsetResolver resolver)
        {
            if (dateTime.Kind != DateTimeKind.Unspecified)
            {
                dateTime = TimeZoneInfo.ConvertTime(dateTime, timeZone);
            }

            var dt = operation.Invoke(dateTime);
            return resolver.Invoke(dt, timeZone);
        }
Exemplo n.º 8
0
 public static DateTimeOffset Add(this DateTime dateTime, TimeSpan timeSpan, TimeZoneInfo timeZone, TimeZoneOffsetResolver resolver)
 {
     var dto = resolver.Invoke(dateTime, timeZone);
     var result = dto.Add(timeSpan);
     return TimeZoneInfo.ConvertTime(result, timeZone);
 }