private static DateTime GetDate(Nest.ValueAggregate valueAggregate)
        {
            if (valueAggregate?.Value == null)
            {
                throw new ArgumentNullException(nameof(valueAggregate));
            }

            var  kind  = DateTimeKind.Utc;
            long ticks = _epochTicks + ((long)valueAggregate.Value * TimeSpan.TicksPerMillisecond);

            if (valueAggregate.Meta.TryGetValue("@timezone", out var value) && value != null)
            {
                kind   = DateTimeKind.Unspecified;
                ticks -= TimeUnit.Parse(value.ToString()).Ticks;
            }

            return(new DateTime(ticks, kind));
        }
Beispiel #2
0
 public void VerifyParseFailure(string value)
 {
     Assert.ThrowsAny <Exception>(() => TimeUnit.Parse(value));
 }
Beispiel #3
0
 public void CanParse(string value, TimeSpan expected)
 {
     Assert.Equal(expected, TimeUnit.Parse(value));
 }