diff --git a/index b/index index d74435d5bee..529cabcce8d 100644 --- a/index +++ b/index @@ -225,12 +225,12 @@
  • 2.4.3.6 Lists of integers
  • 2.4.4 Dates and times
      -
    1. 2.4.4.1 Global dates and times
    2. -
    3. 2.4.4.2 Local dates and times
    4. -
    5. 2.4.4.3 Dates
    6. -
    7. 2.4.4.4 Months
    8. -
    9. 2.4.4.5 Weeks
    10. -
    11. 2.4.4.6 Times
    12. +
    13. 2.4.4.1 Dates
    14. +
    15. 2.4.4.2 Times
    16. +
    17. 2.4.4.3 Local dates and times
    18. +
    19. 2.4.4.4 Global dates and times
    20. +
    21. 2.4.4.5 Months
    22. +
    23. 2.4.4.6 Weeks
    24. 2.4.4.7 Vaguer moments in time
    25. 2.4.4.8 Time offsets
  • 2.4.5 Space-separated tokens
  • @@ -2684,59 +2684,310 @@ 28 otherwise. This takes into account leap years in the Gregorian calendar. [GREGORIAN]

    +

    The digits in the date + and time syntaxes defined in this section must be characters in the + range U+0030 DIGIT ZERO to U+0039 DIGIT NINE, used to express + numbers in base ten.

    -
    2.4.4.1 Global dates and times
    -

    A global date and time - consists of a specific Gregorian date, consisting of a year, a - month, a day, an hour, a minute, a second, and a fraction of a - second, expressed with a time zone, consisting of a number of hours - and minutes. [GREGORIAN]

    +
    2.4.4.1 Dates
    - +

    A date consists of a specific + Gregorian date with no timezone information, consisting of a year, a + month, and a day. [GREGORIAN]

    -

    A string is a valid global date and time string if it - has the components in the following list, in the given order, and if - the components in the list follow the constraints given after the +

    A string is a valid date string if it has the + components in the following list, in the given order, and if the + components in the list follow the constraints given after the list:

    -
    1. Four or more digits (representing the year)
    2. +
      1. Four or more digits (representing the year)
      2. A U+002D HYPHEN-MINUS character (-).
      3. -
      4. Two digits (representing the month)
      5. +
      6. Two digits (representing the month)
      7. A U+002D HYPHEN-MINUS character (-).
      8. -
      9. Two digits (representing the day)
      10. +
      11. Two digits (representing the day)
      12. -
      13. A U+0054 LATIN CAPITAL LETTER T character.
      14. +

      The aforementioned constraints are:

      + +

      The rules to parse a date string are as follows. This + will either return a date, or nothing. If at any point the algorithm + says that it "fails", this means that it is aborted at that point + and returns nothing.

      + +
      1. Let input be the string being + parsed.

      2. + +
      3. Let position be a pointer into input, initially pointing at the start of the + string.

      4. + +
      5. Parse a date component to obtain year, month, and day. If this returns nothing, then fail.

        + +
      6. If position is not beyond the + end of input, then fail.

      7. + +
      8. Let date be the date with year year, month month, and day day.

      9. + +
      10. Return date.

      11. + +

      The rules to parse a date component, given an input string and a position, are + as follows. This will either return a year, a month, and a day, or + nothing. If at any point the algorithm says that it "fails", this + means that it is aborted at that point and returns nothing.

      + +
      1. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not at least four characters long, then + fail. Otherwise, interpret the resulting sequence as a base-ten + integer. Let that number be the year.

      2. + +
      3. If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, + then fail. Otherwise, move position forwards + one character.

      4. + +
      5. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not exactly two characters long, then fail. Otherwise, + interpret the resulting sequence as a base-ten integer. Let that + number be the month.

      6. + +
      7. If month is not a number in the range + 1 ≤ month ≤ 12, then + fail.
      8. -
      9. Two digits (representing the hour)
      10. +
      11. Let maxday be the number of days + in month month of year year.

      12. + +
      13. If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, + then fail. Otherwise, move position forwards + one character.

      14. + +
      15. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not exactly two characters long, then fail. Otherwise, + interpret the resulting sequence as a base-ten integer. Let that + number be the day.

      16. + +
      17. If day is not a number in the range + 1 ≤ month ≤ maxday, then fail.

      18. + +
      19. Return year, month, + and day.

      20. + +
      2.4.4.2 Times
      + +

      A time consists of a specific + time with no timezone information, consisting of an hour, a minute, + a second, and a fraction of a second.

      + +

      A string is a valid time string if it has the + components in the following list, in the given order, and if the + components in the list follow the constraints given after the + list:

      + +
      1. Two digits (representing the hour)
      2. A U+003A COLON character (:).
      3. -
      4. Two digits (representing the minutes)
      5. +
      6. Two digits (representing the minutes)
      7. Optionally:
        1. A U+003A COLON character (:).
        2. -
        3. Two digits (representing the integer part of the seconds)
        4. +
        5. Two digits (representing the integer part of the seconds)
        6. Optionally:
          1. A 002E FULL STOP character (.)
          2. -
          3. One or more digits (representing the fractional part of the seconds)
          4. +
          5. One or more digits (representing the fractional part of the seconds)
      8. +

      The aforementioned constraints are:

      + +

      The rules to parse a time string are as follows. This + will either return a time, or nothing. If at any point the algorithm + says that it "fails", this means that it is aborted at that point + and returns nothing.

      + +
      1. Let input be the string being + parsed.

      2. + +
      3. Let position be a pointer into input, initially pointing at the start of the + string.

      4. + +
      5. Parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

        + +
      6. If position is not beyond the + end of input, then fail.

      7. + +
      8. Let time be the time with hour hour, minute minute, and second + second.

      9. + +
      10. Return time.

      11. + +

      The rules to parse a time component, given an input string and a position, are + as follows. This will either return an hour, a minute, and a second, + or nothing. If at any point the algorithm says that it "fails", this + means that it is aborted at that point and returns nothing.

      + +
      1. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not exactly two characters long, then fail. Otherwise, + interpret the resulting sequence as a base-ten integer. Let that + number be the hour.

      2. + +
      3. If hour is not a number in the range + 0 ≤ hour ≤ 23, then + fail.
      4. + +
      5. If position is beyond the end of input or if the character at position is not a U+003A COLON character, then + fail. Otherwise, move position forwards one + character.

      6. + +
      7. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not exactly two characters long, then fail. Otherwise, + interpret the resulting sequence as a base-ten integer. Let that + number be the minute.

      8. + +
      9. If minute is not a number in the range + 0 ≤ minute ≤ 59, then + fail.
      10. + +
      11. Let second be a string with the value + "0".

      12. + +
      13. + +

        If position is not beyond the end of + input and the character at position is a U+003A COLON, then run these + substeps:

        + +
        1. Advance position to the next character + in input.

        2. + +
        3. If position is beyond the end of input, or at the last character in input, or if the next two characters in + input starting at position are not two characters both in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then + fail.

        4. + +
        5. Collect a sequence of characters that are + either characters in the range U+0030 DIGIT ZERO (0) to U+0039 + DIGIT NINE (9) or U+002E FULL STOP characters. If the collected + sequence has more than one U+002E FULL STOP characters, or if the + last character in the sequence is a U+002E FULL STOP character, + then fail. Otherwise, let the collected string be second instead of its previous value.

        6. + +
      14. + +
      15. Interpret second as a base-ten number + (possibly with a fractional part). Let second + be that number instead of the string version.

      16. + +
      17. If second is not a number in the range + 0 ≤ second < 60, then + fail.
      18. + +
      19. Return hour, minute, + and second.

      20. + +
      2.4.4.3 Local dates and times
      + +

      A local date and time + consists of a specific Gregorian date, consisting of a year, a + month, and a day, and a time, consisting of an hour, a minute, a + second, and a fraction of a second, but expressed without a time + zone. [GREGORIAN]

      + +

      A string is a valid local date and time string if it + has the components in the following list, in the given order:

      + +
      1. A valid date string.
      2. + +
      3. A U+0054 LATIN CAPITAL LETTER T character.
      4. + +
      5. A valid time string.
      6. + +

      The rules to parse a local date and time string are as + follows. This will either return a date and time, or nothing. If at + any point the algorithm says that it "fails", this means that it is + aborted at that point and returns nothing.

      + +
      1. Let input be the string being + parsed.

      2. + +
      3. Let position be a pointer into input, initially pointing at the start of the + string.

      4. + +
      5. Parse a date component to obtain year, month, and day. If this returns nothing, then fail.

        + +
      6. If position is beyond the end of input or if the character at position is not a U+0054 LATIN CAPITAL LETTER T + character then fail. Otherwise, move position + forwards one character.

      7. + +
      8. Parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

        + +
      9. If position is not beyond the + end of input, then fail.

      10. + +
      11. Let date be the date with year year, month month, and day day.

      12. + +
      13. Let time be the time with hour hour, minute minute, and second + second.

      14. + +
      15. Return date and time.

      16. + +
      2.4.4.4 Global dates and times
      + +

      A global date and time + consists of a specific Gregorian date, consisting of a year, a + month, and a day, and a time, consisting of an hour, a minute, a + second, and a fraction of a second, expressed with a time zone, + consisting of a number of hours and minutes. [GREGORIAN]

      + + + +

      A string is a valid global date and time string if it + has the components in the following list, in the given order, and if + the components in the list follow the constraints given after the + list:

      + +
      1. A valid date string.
      2. + +
      3. A U+0054 LATIN CAPITAL LETTER T character.
      4. + +
      5. A valid time string.
      6. +
      7. Either:
        • A U+005A LATIN CAPITAL LETTER Z character (indicating the @@ -2748,11 +2999,11 @@ HYPHEN-MINUS (-) character (the sign of the timezone offset)
        • -
        • Two digits (representing the hours component of the timezone offset)
        • +
        • Two digits (representing the hours component of the timezone offset)
        • A U+003A COLON character (:).
        • -
        • Two digits (representing the minutes component of the timezone offset)
        • +
        • Two digits (representing the minutes component of the timezone offset)
      @@ -2760,26 +3011,7 @@

    The aforementioned constraints are:

    -

    The following are some examples of dates written as valid global date and time strings.

    @@ -2851,104 +3080,13 @@
  • Let position be a pointer into input, initially pointing at the start of the string.

  • -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not at least four characters long, then - fail. Otherwise, interpret the resulting sequence as a base-ten - integer. Let that number be the year.

  • - -
  • If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, - then fail. Otherwise, move position forwards - one character.

  • - -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not exactly two characters long, then fail. Otherwise, - interpret the resulting sequence as a base-ten integer. Let that - number be the month.

  • - -
  • If month is not a number in the range - 1 ≤ month ≤ 12, then - fail.
  • - -
  • Let maxday be the number of days - in month month of year year.

  • - -
  • If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, - then fail. Otherwise, move position forwards - one character.

  • - -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not exactly two characters long, then fail. Otherwise, - interpret the resulting sequence as a base-ten integer. Let that - number be the day.

  • - -
  • If day is not a number in the range - 1 ≤ month ≤ maxday, then fail.

  • +
  • Parse a date component to obtain year, month, and day. If this returns nothing, then fail.

  • If position is beyond the end of input or if the character at position is not a U+0054 LATIN CAPITAL LETTER T character then fail. Otherwise, move position forwards one character.

  • -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not exactly two characters long, then fail. Otherwise, - interpret the resulting sequence as a base-ten integer. Let that - number be the hour.

  • - -
  • If hour is not a number in the range - 0 ≤ hour ≤ 23, then - fail.
  • - -
  • If position is beyond the end of input or if the character at position is not a U+003A COLON character, then - fail. Otherwise, move position forwards one - character.

  • - -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not exactly two characters long, then fail. Otherwise, - interpret the resulting sequence as a base-ten integer. Let that - number be the minute.

  • - -
  • If minute is not a number in the range - 0 ≤ minute ≤ 59, then - fail.
  • - -
  • Let second be a string with the value - "0".

  • - -
  • If position is beyond the end of input, then fail.

  • - -
  • - -

    If the character at position is a U+003A - COLON, then run these substeps:

    - -
    1. Advance position to the next character - in input.

    2. - -
    3. If position is beyond the end of input, or at the last character in input, or if the next two characters in - input starting at position are not two characters both in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then - fail.

    4. - -
    5. Collect a sequence of characters that are - either characters in the range U+0030 DIGIT ZERO (0) to U+0039 - DIGIT NINE (9) or U+002E FULL STOP characters. If the collected - sequence has more than one U+002E FULL STOP characters, or if the - last character in the sequence is a U+002E FULL STOP character, - then fail. Otherwise, let the collected string be second instead of its previous value.

    6. - -
  • - -
  • Interpret second as a base-ten number - (possibly with a fractional part). Let second - be that number instead of the string version.

  • - -
  • If second is not a number in the range - 0 ≤ second < 60, then - fail.
  • +
  • Parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

  • If position is beyond the end of input, then fail.

  • @@ -3019,31 +3157,7 @@
  • Return time and timezone.

  • -
    2.4.4.2 Local dates and times
    - -

    A local date and time - consists of a specific Gregorian date with no timezone information, - consisting of a year, a month, a day, an hour, a minute, a second, - and a fraction of a second. [GREGORIAN]

    - -

    ... valid local date and time string

    - -

    ... rules to parse a local date and time - string

    - - -
    2.4.4.3 Dates
    - -

    A date consists of a specific - Gregorian date with no timezone information, consisting of a year, a - month, and a day. [GREGORIAN]

    - -

    ... valid date string

    - -

    ... rules to parse a date string

    - - -
    2.4.4.4 Months
    +
    2.4.4.5 Months

    A month consists of a specific Gregorian date with no timezone information and no date information @@ -3054,7 +3168,7 @@

    ... rules to parse a month string

    -
    2.4.4.5 Weeks
    +
    2.4.4.6 Weeks

    A week consists of a specific Gregorian date with no timezone information and no date information @@ -3067,17 +3181,6 @@

    ... rules to parse a week string

    -
    2.4.4.6 Times
    - -

    A time consists of a specific - time with no timezone information, consisting of an hour, a minute, - a second, and a fraction of a second.

    - -

    ... valid time string

    - -

    ... rules to parse a time string

    - -
    2.4.4.7 Vaguer moments in time
    diff --git a/source b/source index 184ec7287ee..5050bbd37bd 100644 --- a/source +++ b/source @@ -1952,44 +1952,156 @@ Gregorian calendar. [GREGORIAN]

    +

    The digits in the date + and time syntaxes defined in this section must be characters in the + range U+0030 DIGIT ZERO to U+0039 DIGIT NINE, used to express + numbers in base ten.

    -
    Global dates and times
    -

    A global date and time - consists of a specific Gregorian date, consisting of a year, a - month, a day, an hour, a minute, a second, and a fraction of a - second, expressed with a time zone, consisting of a number of hours - and minutes. [GREGORIAN]

    +
    Dates
    - +

    A date consists of a specific + Gregorian date with no timezone information, consisting of a year, a + month, and a day. [GREGORIAN]

    -

    A string is a valid global date and time string if it - has the components in the following list, in the given order, and if - the components in the list follow the constraints given after the +

    A string is a valid date string if it has the + components in the following list, in the given order, and if the + components in the list follow the constraints given after the list:

      -
    1. Four or more digits (representing the year)
    2. +
    3. Four or more digits (representing the year)
    4. A U+002D HYPHEN-MINUS character (-).
    5. -
    6. Two digits (representing the month)
    7. +
    8. Two digits (representing the month)
    9. A U+002D HYPHEN-MINUS character (-).
    10. -
    11. Two digits (representing the day)
    12. +
    13. Two digits (representing the day)
    14. -
    15. A U+0054 LATIN CAPITAL LETTER T character.
    16. +
    + +

    The aforementioned constraints are:

    + + + +

    The rules to parse a date string are as follows. This + will either return a date, or nothing. If at any point the algorithm + says that it "fails", this means that it is aborted at that point + and returns nothing.

    + +
      + +
    1. Let input be the string being + parsed.

    2. + +
    3. Let position be a pointer into input, initially pointing at the start of the + string.

    4. + +
    5. Parse a date component to obtain year, month, and day. If this returns nothing, then fail.

      + +
    6. If position is not beyond the + end of input, then fail.

    7. + +
    8. Let date be the date with year year, month month, and day day.

    9. + +
    10. Return date.

    11. + +
    + +

    The rules to parse a date component, given an input string and a position, are + as follows. This will either return a year, a month, and a day, or + nothing. If at any point the algorithm says that it "fails", this + means that it is aborted at that point and returns nothing.

    + +
      + +
    1. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not at least four characters long, then + fail. Otherwise, interpret the resulting sequence as a base-ten + integer. Let that number be the year.

    2. + +
    3. If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, + then fail. Otherwise, move position forwards + one character.

    4. + +
    5. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not exactly two characters long, then fail. Otherwise, + interpret the resulting sequence as a base-ten integer. Let that + number be the month.

    6. + +
    7. If month is not a number in the range + 1 ≤ month ≤ 12, then + fail.
    8. + +
    9. Let maxday be the number of days + in month month of year year.

    10. + +
    11. If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, + then fail. Otherwise, move position forwards + one character.

    12. + +
    13. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not exactly two characters long, then fail. Otherwise, + interpret the resulting sequence as a base-ten integer. Let that + number be the day.

    14. + +
    15. If day is not a number in the range + 1 ≤ month ≤ maxday, then fail.

    16. + +
    17. Return year, month, + and day.

    18. + +
    + + + +
    Times
    + +

    A time consists of a specific + time with no timezone information, consisting of an hour, a minute, + a second, and a fraction of a second.

    + +

    A string is a valid time string if it has the + components in the following list, in the given order, and if the + components in the list follow the constraints given after the + list:

    + +
      -
    1. Two digits (representing the hour)
    2. +
    3. Two digits (representing the hour)
    4. A U+003A COLON character (:).
    5. -
    6. Two digits (representing the minutes)
    7. +
    8. Two digits (representing the minutes)
    9. Optionally: @@ -1997,7 +2109,7 @@
    10. A U+003A COLON character (:).
    11. -
    12. Two digits (representing the integer part of the seconds)
    13. +
    14. Two digits (representing the integer part of the seconds)
    15. Optionally: @@ -2005,7 +2117,7 @@
    16. A 002E FULL STOP character (.)
    17. -
    18. One or more digits (representing the fractional part of the seconds)
    19. +
    20. One or more digits (representing the fractional part of the seconds)
    @@ -2015,6 +2127,233 @@ + + +

    The aforementioned constraints are:

    + + + +

    The rules to parse a time string are as follows. This + will either return a time, or nothing. If at any point the algorithm + says that it "fails", this means that it is aborted at that point + and returns nothing.

    + +
      + +
    1. Let input be the string being + parsed.

    2. + +
    3. Let position be a pointer into input, initially pointing at the start of the + string.

    4. + +
    5. Parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

      + +
    6. If position is not beyond the + end of input, then fail.

    7. + +
    8. Let time be the time with hour hour, minute minute, and second + second.

    9. + +
    10. Return time.

    11. + +
    + +

    The rules to parse a time component, given an input string and a position, are + as follows. This will either return an hour, a minute, and a second, + or nothing. If at any point the algorithm says that it "fails", this + means that it is aborted at that point and returns nothing.

    + +
      + +
    1. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not exactly two characters long, then fail. Otherwise, + interpret the resulting sequence as a base-ten integer. Let that + number be the hour.

    2. + +
    3. If hour is not a number in the range + 0 ≤ hour ≤ 23, then + fail.
    4. + +
    5. If position is beyond the end of input or if the character at position is not a U+003A COLON character, then + fail. Otherwise, move position forwards one + character.

    6. + +
    7. Collect a sequence of characters in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected + sequence is not exactly two characters long, then fail. Otherwise, + interpret the resulting sequence as a base-ten integer. Let that + number be the minute.

    8. + +
    9. If minute is not a number in the range + 0 ≤ minute ≤ 59, then + fail.
    10. + +
    11. Let second be a string with the value + "0".

    12. + +
    13. + +

      If position is not beyond the end of + input and the character at position is a U+003A COLON, then run these + substeps:

      + +
        + +
      1. Advance position to the next character + in input.

      2. + +
      3. If position is beyond the end of input, or at the last character in input, or if the next two characters in + input starting at position are not two characters both in the range + U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then + fail.

      4. + +
      5. Collect a sequence of characters that are + either characters in the range U+0030 DIGIT ZERO (0) to U+0039 + DIGIT NINE (9) or U+002E FULL STOP characters. If the collected + sequence has more than one U+002E FULL STOP characters, or if the + last character in the sequence is a U+002E FULL STOP character, + then fail. Otherwise, let the collected string be second instead of its previous value.

      6. + +
      + +
    14. + +
    15. Interpret second as a base-ten number + (possibly with a fractional part). Let second + be that number instead of the string version.

    16. + +
    17. If second is not a number in the range + 0 ≤ second < 60, then + fail.
    18. + +
    19. Return hour, minute, + and second.

    20. + +
    + + + +
    Local dates and times
    + +

    A local date and time + consists of a specific Gregorian date, consisting of a year, a + month, and a day, and a time, consisting of an hour, a minute, a + second, and a fraction of a second, but expressed without a time + zone. [GREGORIAN]

    + +

    A string is a valid local date and time string if it + has the components in the following list, in the given order:

    + +
      + +
    1. A valid date string.
    2. + +
    3. A U+0054 LATIN CAPITAL LETTER T character.
    4. + +
    5. A valid time string.
    6. + +
    + +

    The rules to parse a local date and time string are as + follows. This will either return a date and time, or nothing. If at + any point the algorithm says that it "fails", this means that it is + aborted at that point and returns nothing.

    + +
      + +
    1. Let input be the string being + parsed.

    2. + +
    3. Let position be a pointer into input, initially pointing at the start of the + string.

    4. + +
    5. Parse a date component to obtain year, month, and day. If this returns nothing, then fail.

      + +
    6. If position is beyond the end of input or if the character at position is not a U+0054 LATIN CAPITAL LETTER T + character then fail. Otherwise, move position + forwards one character.

    7. + +
    8. Parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

      + +
    9. If position is not beyond the + end of input, then fail.

    10. + +
    11. Let date be the date with year year, month month, and day day.

    12. + +
    13. Let time be the time with hour hour, minute minute, and second + second.

    14. + +
    15. Return date and time.

    16. + +
    + + + +
    Global dates and times
    + +

    A global date and time + consists of a specific Gregorian date, consisting of a year, a + month, and a day, and a time, consisting of an hour, a minute, a + second, and a fraction of a second, expressed with a time zone, + consisting of a number of hours and minutes. [GREGORIAN]

    + + + +

    A string is a valid global date and time string if it + has the components in the following list, in the given order, and if + the components in the list follow the constraints given after the + list:

    + +
      + +
    1. A valid date string.
    2. + +
    3. A U+0054 LATIN CAPITAL LETTER T character.
    4. + +
    5. A valid time string.
    6. +
    7. Either:
        @@ -2030,11 +2369,11 @@ HYPHEN-MINUS (-) character (the sign of the timezone offset) -
      • Two digits (representing the hours component of the timezone offset)
      • +
      • Two digits (representing the hours component of the timezone offset)
      • A U+003A COLON character (:).
      • -
      • Two digits (representing the minutes component of the timezone offset)
      • +
      • Two digits (representing the minutes component of the timezone offset)
    @@ -2050,27 +2389,6 @@ -

    The digits must be characters in the range U+0030 DIGIT ZERO to - U+0039 DIGIT NINE, used to express numbers in base ten.

    -

    The following are some examples of dates written as input, initially pointing at the start of the string.

    -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not at least four characters long, then - fail. Otherwise, interpret the resulting sequence as a base-ten - integer. Let that number be the year.

  • - -
  • If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, - then fail. Otherwise, move position forwards - one character.

  • - -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not exactly two characters long, then fail. Otherwise, - interpret the resulting sequence as a base-ten integer. Let that - number be the month.

  • - -
  • If month is not a number in the range - 1 ≤ month ≤ 12, then - fail.
  • - -
  • Let maxday be the number of days - in month month of year year.

  • - -
  • If position is beyond the end of input or if the character at position is not a U+002D HYPHEN-MINUS character, - then fail. Otherwise, move position forwards - one character.

  • - -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not exactly two characters long, then fail. Otherwise, - interpret the resulting sequence as a base-ten integer. Let that - number be the day.

  • - -
  • If day is not a number in the range - 1 ≤ month ≤ maxday, then fail.

  • +
  • Parse a date component to obtain year, month, and day. If this returns nothing, then fail.

  • If position is beyond the end of input or if the character at position forwards one character.

  • -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not exactly two characters long, then fail. Otherwise, - interpret the resulting sequence as a base-ten integer. Let that - number be the hour.

  • - -
  • If hour is not a number in the range - 0 ≤ hour ≤ 23, then - fail.
  • - -
  • If position is beyond the end of input or if the character at position is not a U+003A COLON character, then - fail. Otherwise, move position forwards one - character.

  • - -
  • Collect a sequence of characters in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). If the collected - sequence is not exactly two characters long, then fail. Otherwise, - interpret the resulting sequence as a base-ten integer. Let that - number be the minute.

  • - -
  • If minute is not a number in the range - 0 ≤ minute ≤ 59, then - fail.
  • - -
  • Let second be a string with the value - "0".

  • - -
  • If position is beyond the end of input, then fail.

  • - -
  • - -

    If the character at position is a U+003A - COLON, then run these substeps:

    - -
      - -
    1. Advance position to the next character - in input.

    2. - -
    3. If position is beyond the end of input, or at the last character in input, or if the next two characters in - input starting at position are not two characters both in the range - U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then - fail.

    4. - -
    5. Collect a sequence of characters that are - either characters in the range U+0030 DIGIT ZERO (0) to U+0039 - DIGIT NINE (9) or U+002E FULL STOP characters. If the collected - sequence has more than one U+002E FULL STOP characters, or if the - last character in the sequence is a U+002E FULL STOP character, - then fail. Otherwise, let the collected string be second instead of its previous value.

    6. - -
    - -
  • - -
  • Interpret second as a base-ten number - (possibly with a fractional part). Let second - be that number instead of the string version.

  • - -
  • If second is not a number in the range - 0 ≤ second < 60, then - fail.
  • +
  • Parse a time component to obtain hour, minute, and second. If this returns nothing, then fail.

  • If position is beyond the end of input, then fail.

  • @@ -2375,30 +2586,6 @@ -
    Local dates and times
    - -

    A local date and time - consists of a specific Gregorian date with no timezone information, - consisting of a year, a month, a day, an hour, a minute, a second, - and a fraction of a second. [GREGORIAN]

    - -

    ... valid local date and time string

    - -

    ... rules to parse a local date and time - string

    - - -
    Dates
    - -

    A date consists of a specific - Gregorian date with no timezone information, consisting of a year, a - month, and a day. [GREGORIAN]

    - -

    ... valid date string

    - -

    ... rules to parse a date string

    -
    Months
    @@ -2426,17 +2613,6 @@

    ... rules to parse a week string

    -
    Times
    - -

    A time consists of a specific - time with no timezone information, consisting of an hour, a minute, - a second, and a fraction of a second.

    - -

    ... valid time string

    - -

    ... rules to parse a time string

    - -
    Vaguer moments in time