1// Copyright 2019 Google LLC. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14// 15 16syntax = "proto3"; 17 18package google.actions.type; 19 20import "google/type/date.proto"; 21 22option go_package = "google.golang.org/genproto/googleapis/type/date_range;date_range"; 23option java_multiple_files = true; 24option java_outer_classname = "DateRangeProto"; 25option java_package = "com.google.actions.type"; 26option objc_class_prefix = "AOGTP"; 27 28// Represents a range based on whole or partial calendar dates, e.g. the 29// duration of a hotel reservation or the Common Era. This can represent: 30// 31// * A range between full dates, e.g. the duration of a hotel reservation 32// * A range between years, e.g. a historical era 33// * A range between year/month dates, e.g. the duration of a job on a resume 34// * A range beginning in a year, e.g. the Common Era 35// * A range ending on a specific date, e.g. the period of time before an event 36// 37// While [google.type.Date][google.type.Date] allows zero years, DateRange does not. Year must 38// always be non-zero. 39// 40// End cannot be chronologically before start. For example, if start has year 41// 2000, end cannot have year 1999. 42// 43// When both set, start and end must have exactly the same precision. That is, 44// they must have the same fields populated with non-zero values. For example, 45// if start specifies only year and month, then end must also specify only year 46// and month (but not day). 47// 48// The date range is inclusive. That is, the dates specified by start and end 49// are part of the date range. For example, the date January 1, 2000 falls 50// within any date with start or end equal to January 1, 2000. When determining 51// whether a date is inside a date range, the date should only be compared to 52// start and end when those values are set. 53// 54// When a date and date range are specified to different degrees of precision, 55// the rules for evaluating whether that date is inside the date range are as 56// follows: 57// 58// * When comparing the date to the start of the date range, unspecified months 59// should be replaced with 1, and unspecified days should be replaced with 1. 60// For example, the year 2000 is within the date range with start equal to 61// January 1, 2000 and no end. And the date January 1, 2000 is within the 62// date range with start equal to the year 2000 and no end. 63// 64// * When comparing the date to the end of the date range, unspecified months 65// should be replaced with 12, and unspecified days should be replaced with 66// the last valid day for the month/year. For example, the year 2000 is 67// within the date range with start equal to January 1, 1999 and end equal to 68// December 31, 2000. And the date December 31, 2001 is within the date range 69// with start equal to the year 2000 and end equal to the year 2001. 70// 71// The semantics of start and end are the same as those of [google.type.Date][google.type.Date], 72// except that year must always be non-zero in DateRange. 73message DateRange { 74 // Date at which the date range begins. If unset, the date range has no 75 // beginning bound. 76 google.type.Date start = 1; 77 78 // Date at which the date range ends. If unset, the date range has no ending 79 // bound. 80 google.type.Date end = 2; 81} 82