About time spans

February 20, 2020 ยท View on GitHub

A TimeSpan defines a contiguous or non-contiguous period of time. It is used to specify when a Rule applies, in order to form a complete regulation. It supports variety of different concepts for expressing time which may be combined together.

Multiple TimeSpans may be combined into the same "clause". Whether these are subject to a logical AND operation or a logical OR operation depends on their position within an array. The examples below provide additional context.

Some of the concepts supported by TimeSpan:

TypeDescriptionExample(s)
time of dayA span of time during a daybetween 7am and 9:30am
day of weekSpecific days of the weekMonday or Weekdays
day of monthSpecific days each month15th day of month or last day of the month or odd numbered days
selected day of weekCertain days of the week within each month1st and 3rd Friday of the month or odd-numbered Thursdays
fixed date rangesSpecific date rangesAugust 2nd, 2018 through August 5th, 2018
annual date rangesDate ranges that apply every yearApril 1st through November 30th
designated periodsExternally-defined named designations for time periodsHolidays or Game Days or Snow Emergencies

Definition

A GeoJSON feature may include TimeSpans made up of the following fields. The TimeSpan(s) are always expressed as an array in order to provide a consistent format regardless of whether a given regulation has a single or multiple TimeSpans. Several fields within the TimeSpan are always expressed as arrays for the same reason.

Field nameTypeDescriptionExample
effectiveDatesarraySpecific date range (or multiple date ranges) that define a fixed span of time or an annual period
effectiveDates.fromstring (MM-DD or YYYY-MM-DD)The beginning date of a time period. This is either a full date or a month and day that will define the timespan on an annual basis2018-08-02 or 04-01
effectiveDates.tostring (MMDD or YYYY-MM-DD)The ending date of a time period. This is either a full date or a month and day that will define the timespan on an annual basis2018-08-05 or 11-30
daysOfWeekobjectDetermines which days of the week will be included in a timespan.
daysOfWeek.daysarray of enum (string) Values: mo tu we th fr saList of days to include in the timespanTo specify weekdays: ["mo", "tu", "we", "th", "fr"]
daysOfWeek.occurrencesInMontharray of enum. Values: 1st 2nd 3rd 4th 5th lastModifier to indicate which occurrences of the specified days within the month to include in the timespan["1st", "3rd"]
daysOfMontharray of enum (string) Values: 1-31, last, odd, evenSpecify specific days during the month to include in the timespanTo specify the 14th and last day of the month ["14", "last"]
timesOfDayarraySpecific time range during the day (or multiple time ranges)
timesOfDay.fromstring (HH:MM)The beginning time (24H) of the time range07:00
timesOfDay.tostring (HH:MM)The ending time (24H) of the time range09:30
designatedPeriodsarrayAn arbitrary, externally-defined named period of time. TimeSpan can be defined to only apply during a designated period or at all times except during a designated period.
designatedPeriods.namestringThe name of designated period.snow emergency or holidays
designatedPeriods.applyenum (string) Values: only during or except duringWill the designated period be excluded from the timespan or will the timespan only apply during the period.Except Holidays: except during or During Snow Emergency: only during

When multiple "clauses" are combined in a single TimeSpan, a logical AND operation is applied. For example, a TimeSpan that includes Wednesdays and the period of February 1st through April 30th specifies all Wednesdays between February 1st and April 30th. It does not specify all Wednesdays during the year AND all days between February 1st and April 30th (the equivalent of a logical OR operation).

When multiple "clauses" are part of a single TimeSpan field but defined in separate TimeSpans, a logical OR operation is applied. For example, a regulation may contain a TimeSpan that specifies weekdays from 9am-5pm, and another TimeSpan that specifies weekends from 11-2. See examples below for further clarification.

Data fields should generally be considered case insensitive since they are used programmatically; we use lower-case in our examples, except for fields that would be used for display purposes (such as a street name or agency name).

Examples

The links below show real world curb regulations translated into CurbLR.

LinkDescription
Examples of simple regulationsSimple regulatory scenarios typically involving one or two basic restrictions
Examples of complex regulationsComplex regulatory scenarios typically involving several restrictions
Sample of downtown Portland's parking regulationsContains data for about 3 miles of parking regulations, surveyed in November 2019. This can also be viewed at demo.curblr.org

No standing at fire hydrant

TimeSpan applies at all times.

{
}

No overnight parking

TimeSpan applies overnight (midnight until 6am).

{
  "timeSpans": [
    {
      "timesOfDay": [
        {"from": "00:00", "to": "06:00"}
      ]
    }
  ]
}

Rush hour (AM and PM) parking regulation

TimeSpan applies during the morning and evening rush hours. Providing the two times of day as separate "clauses" in an array means that a logical OR expression is applied.

{
  "timeSpans": [
    {
      "timesOfDay": [
        {"from": "07:30", "to": "09:30"},
        {"from": "16:00", "to": "18:00"}
      ]
    }
  ]
}

Different weekday and weekend time periods

TimeSpan applies on weekdays from 8am to 8pm, and on Sundays from 11am to 8pm. Providing the two times of day as separate "clauses" in an array means that a logical OR expression is applied.

{
  "timeSpans": [
    {
      "daysOfWeek": {
        "days": ["mo", "tu", "we", "th", "fr"]
      },
      "timesOfDay": [
        {"from": "08:00", "to": "20:00"}
      ]
    },
    {
      "daysOfWeek": {
        "days": ["su"]
      },
      "timesOfDay": [
        {"from": "11:00", "to": "20:00"}
      ]
    }
  ]
}

No parking during snow emergency

TimeSpan in effect only during a snow emergency.

{
  "timeSpans": [
    {
      "designatedPeriods": [
        {"name": "snow emergency", "apply": "only during"}
      ]
    }
  ]
}

Meters in effect

TimeSpan applies Monday through Saturday between 8am and 8pm, except holidays.

{
  "timeSpans": [
    {
      "daysOfWeek": {
        "days": ["mo", "tu", "we", "th", "fr", "sa"]
      },
      "timesOfDay": [
        {"from": "08:00", "until": "20:00"}
      ],
      "designatedPeriods": [
        {"name": "holidays", "apply": "except during"}
      ]
    }
  ]
}

Temporary construction permit

TimeSpan applies during designated construction hours (7am until 7pm) for the days during which the permit is valid (August 2nd, 2018 through August 5th, 2018).

{
  "timeSpans": [
    {
      "timesOfDay": [
        {"from": "07:00", "to": "19:00"},
      ],
      "effectiveDates": [
        {"from": "2018-08-02", "to": "2018-08-05"}
      ]
    }
  ]
}

Alternate side parking for overnight snow removal

TimeSpan applies on odd number days between December 1st and March 31st from 1am until 6am.

{
  "timeSpans": [
    {
      "daysOfMonth": ["odd"],
      "timesOfDay": [
        {"from": "01:00", "to": "06:00"}
      ],
      "effectiveDates": [
        {"from": "12-01", "to": "03-31"}
      ]
    }
  ]
}

Bi-weekly street cleaning

TimeSpan applies between 11am and 1pm on the 2nd and 4th Tuesday of every month between April 1st and November 30th each year.

{
  "timeSpans": [
    {
      "daysOfWeek": {
        "days": ["tu"],
        "occurrencesInMonth": ["2nd", "4th"]
      },
      "timesOfDay": [
        {"from": "11:00", "to": "13:00"}
      ],
      "effectiveDates": [
        {"from": "04-01", "to": "11-30"}
      ]
    }
  ]
}