{"record":{"id":"5b04812c6f1dc563","repo":"GitoxideLabs/gitoxide","slug":"could-not-convert-date-to-a-point-in-time","errorCode":null,"errorMessage":"Could not convert date to a point in time","messagePattern":"Could not convert date to a point in time","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-date/src/parse/relative.rs","lineNumber":177,"sourceCode":"                time: zdt.time(),\n                timezone: zdt.time_zone().clone(),\n            }\n        }\n    }\n\n    impl Fields {\n        /// Turn the fields back into a point in time: a day beyond the end of the month rolls over into the\n        /// following month. One month before May 31st is thus May 1st, a day after April 30th.\n        fn normalize(&self) -> Result<Zoned, Exn<Error>> {\n            let first_of_month = civil::Date::new(self.year, self.month, 1)\n                .or_raise(|| Error::new(format!(\"Date lies out of range: {}-{:02}\", self.year, self.month)))?;\n            let days_beyond_first = SignedDuration::from_secs((i64::from(self.day) - 1) * 24 * 60 * 60);\n            first_of_month\n                .checked_add(days_beyond_first)\n                .or_raise(|| Error::new(format!(\"Day {} lies out of range\", self.day)))?\n                .to_datetime(self.time)\n                .to_zoned(self.timezone.clone())\n                .or_raise(|| Error::new(\"Could not convert date to a point in time\"))\n        }\n    }\n\n    let now = now.ok_or(ValidationError::new(\"Missing current time\"))?;\n    let mut fields = Fields::from(now);\n    for Pair { period, count, unit } in pairs {\n        let err = || Error::new(format!(\"Couldn't parse span from '{period} {count}'\"));\n        match unit {\n            Unit::Seconds(factor) => {\n                let seconds = count\n                    .checked_mul(*factor)\n                    .map(SignedDuration::from_secs)\n                    .ok_or_else(err)?;\n                let ts = fields.normalize()?.timestamp().checked_sub(seconds).or_raise(err)?;\n                fields = ts.to_zoned(fields.timezone.clone()).into();\n            }\n            Unit::Months(factor) => {\n                let months = count.checked_mul(*factor).ok_or_else(err)?;","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-date/src/parse/relative.rs#L159-L195","documentation":"The final step of `Fields::normalize()` converts the normalized civil datetime plus time into a `Zoned` point in time using the configured timezone; if jiff cannot perform that conversion (e.g. ambiguity/timezone resolution failure), the code raises Error 'Could not convert date to a point in time'. This indicates the calendar date is valid but cannot be anchored to a concrete instant.","triggerScenarios":"Relative-date parsing where `to_zoned(timezone)` fails for the computed date/time in the given timezone — e.g. a timezone whose database lookup fails or a local time that cannot be resolved at that date.","commonSituations":"Systems with missing/invalid TZ settings, or relative dates near timezone-boundary edge cases when gix-date is used to compute '3 weeks ago'-style timestamps.","solutions":["Ensure a valid timezone is configured (valid TZ environment/database entry) or pass an explicit known-good `TimeZone`","Catch the Error and retry with UTC as a fallback timezone","Verify the gix-date/jiff timezone database feature is enabled in your build"],"exampleFix":"// before\nparse_relative(\"2 weeks ago\", None) // relies on ambient TZ\n// after\nparse_relative(\"2 weeks ago\", Some(TimeZone::UTC))","handlingStrategy":"fallback","validationCode":"let tz = gix_date::time::TimeZone::from_env().unwrap_or(TimeZone::UTC);","typeGuard":null,"tryCatchPattern":"let zoned = fields.normalize().or_else(|_| normalize_in_utc());","preventionTips":["Always configure a valid timezone or default to UTC","Ensure the timezone database is available in your deployment (e.g. feature flags for jiff tz data)","Avoid relying on ambient TZ in containers/minimal images"],"tags":["date","timezone"],"backgroundTag":"timezone-conversion-failed","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}