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