internal ZonedDateTimeParseBucket(ZonedDateTime templateValue, ZoneLocalMappingResolver resolver, IDateTimeZoneProvider zoneProvider) { Date = new LocalDatePatternParser.LocalDateParseBucket(templateValue.Date); Time = new LocalTimePatternParser.LocalTimeParseBucket(templateValue.TimeOfDay); Zone = templateValue.Zone; this.resolver = resolver; this.zoneProvider = zoneProvider; }
internal ZonedDateTimeParseBucket(LocalDate templateDate, LocalTime templateTime, DateTimeZone templateZone, ZoneLocalMappingResolver resolver, IDateTimeZoneProvider zoneProvider) { Date = new LocalDatePatternParser.LocalDateParseBucket(templateDate); Time = new LocalTimePatternParser.LocalTimeParseBucket(templateTime); Zone = templateZone; this.resolver = resolver; this.zoneProvider = zoneProvider; }
/// <summary> /// Combines the values in a date bucket with the values in a time bucket. /// </summary> /// <remarks> /// This would normally be the <see cref="CalculateValue"/> method, but we want /// to be able to use the same logic when parsing an <see cref="OffsetDateTime"/> /// and <see cref="ZonedDateTime"/>. /// </remarks> internal static ParseResult <LocalDateTime> CombineBuckets( PatternFields usedFields, LocalDatePatternParser.LocalDateParseBucket dateBucket, LocalTimePatternParser.LocalTimeParseBucket timeBucket, string text) { // Handle special case of hour = 24 bool hour24 = false; if (timeBucket.Hours24 == 24) { timeBucket.Hours24 = 0; hour24 = true; } ParseResult <LocalDate> dateResult = dateBucket.CalculateValue(usedFields & PatternFields.AllDateFields, text); if (!dateResult.Success) { return(dateResult.ConvertError <LocalDateTime>()); } ParseResult <LocalTime> timeResult = timeBucket.CalculateValue(usedFields & PatternFields.AllTimeFields, text); if (!timeResult.Success) { return(timeResult.ConvertError <LocalDateTime>()); } LocalDate date = dateResult.Value; LocalTime time = timeResult.Value; if (hour24) { if (time != LocalTime.Midnight) { return(ParseResult <LocalDateTime> .InvalidHour24(text)); } date = date.PlusDays(1); } return(ParseResult <LocalDateTime> .ForValue(date + time)); }
internal OffsetDateTimeParseBucket(OffsetDateTime templateValue) { Date = new LocalDatePatternParser.LocalDateParseBucket(templateValue.Date); Time = new LocalTimePatternParser.LocalTimeParseBucket(templateValue.TimeOfDay); Offset = templateValue.Offset; }
internal LocalDateTimeParseBucket(LocalDate templateValueDate, LocalTime templateValueTime) { Date = new LocalDatePatternParser.LocalDateParseBucket(templateValueDate); Time = new LocalTimePatternParser.LocalTimeParseBucket(templateValueTime); }
internal OffsetDateTimeParseBucket(LocalDate templateDate, LocalTime templateTime, Offset templateOffset) { Date = new LocalDatePatternParser.LocalDateParseBucket(templateDate); Time = new LocalTimePatternParser.LocalTimeParseBucket(templateTime); Offset = templateOffset; }
internal OffsetDateParseBucket(OffsetDate templateValue) { Date = new LocalDatePatternParser.LocalDateParseBucket(templateValue.Date); Offset = templateValue.Offset; }