{"record":{"id":"dfe2575759f8ba8a","repo":"pola-rs/polars","slug":"activate-feature-dtype-datetime","errorCode":null,"errorMessage":"activate feature dtype-datetime","messagePattern":"activate feature dtype-datetime","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-core/src/series/mod.rs","lineNumber":979,"sourceCode":"        #[cfg(feature = \"dtype-date\")]\n        match self.dtype() {\n            DataType::Int32 => self.i32().unwrap().clone().into_date().into_series(),\n            DataType::Date => self\n                .date()\n                .unwrap()\n                .physical()\n                .clone()\n                .into_date()\n                .into_series(),\n            dt => panic!(\"date not implemented for {dt:?}\"),\n        }\n    }\n\n    #[allow(unused_variables)]\n    pub fn into_datetime(self, timeunit: TimeUnit, tz: Option<TimeZone>) -> Series {\n        #[cfg(not(feature = \"dtype-datetime\"))]\n        {\n            panic!(\"activate feature dtype-datetime\")\n        }\n\n        #[cfg(feature = \"dtype-datetime\")]\n        match self.dtype() {\n            DataType::Int64 => self\n                .i64()\n                .unwrap()\n                .clone()\n                .into_datetime(timeunit, tz)\n                .into_series(),\n            DataType::Datetime(_, _) => self\n                .datetime()\n                .unwrap()\n                .physical()\n                .clone()\n                .into_datetime(timeunit, tz)\n                .into_series(),\n            dt => panic!(\"into_datetime not implemented for {dt:?}\"),","sourceCodeStart":961,"sourceCodeEnd":997,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-core/src/series/mod.rs#L961-L997","documentation":"Series::into_datetime is compiled out when the dtype-datetime feature is disabled; the panic tells the caller to rebuild with the dtype-datetime feature because Datetime dtype support is feature-gated.","triggerScenarios":"Calling into_datetime(timeunit, tz) (directly or via finish_cast when casting to Datetime) on a build compiled without dtype-datetime.","commonSituations":"Minimal polars builds with default-features = false; timestamp reinterpretation in slim or wasm-targeted builds.","solutions":["Add the feature: polars = { version = \"...\", features = [\"dtype-datetime\"] }","Enable 'temporal', 'lazy', or 'default' feature sets that include dtype-datetime","Keep timestamps as Int64 epoch values if datetime support is not needed"],"exampleFix":"// before\npolars = { version = \"0.40\", default-features = false }\n// after\npolars = { version = \"0.40\", default-features = false, features = [\"dtype-datetime\"] }","handlingStrategy":"validation","validationCode":"#[cfg(not(feature = \"dtype-datetime\"))]\ncompile_error!(\"polars 'dtype-datetime' feature required\");","typeGuard":null,"tryCatchPattern":"let s: PolarsResult<Series> = series.strict_cast(&DataType::Datetime(TimeUnit::Ns, None));","preventionTips":["Enable dtype-datetime in slim builds that handle timestamps","Use 'temporal'/'lazy' feature bundles","Test timestamp paths on the exact feature set used in production"],"tags":["polars","rust","cargo-features","feature-gate","datetime"],"backgroundTag":"feature-not-enabled","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}