error invalid-date
What it means#
The lexer recognises dates greedily by the template DDDD-DD-DD[TDD:DD[:DD[.D+]]][Z] (§1.5) and then validates the value: the month must be 01-12, the day must exist in that month, the hour 00-23, and the minutes and seconds 00-59. A trailing Z makes the literal a UTC Time; without it the type is Date or LocalDateTime.
Example#
fn main() {
let release = 2026-13-45 // <- invalid-date
}error
invalid-date
How to fix#
fn main() {
let release = 2026-11-03
}Correct the components. To subtract numbers that look like a date, write spaces around the minus sign: 2026 - 11.