1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
use polars_core::datatypes::DataType;
use polars_core::prelude::TimeUnit;
#[derive(Debug, Clone)]
pub struct StrpTimeOptions {
/// DataType to parse in. One of {Date, Datetime}
pub date_dtype: DataType,
/// Formatting string
pub fmt: Option<String>,
/// If set then polars will return an error if any date parsing fails
pub strict: bool,
/// If polars may parse matches that not contain the whole string
/// e.g. "foo-2021-01-01-bar" could match "2021-01-01"
pub exact: bool,
}
impl Default for StrpTimeOptions {
fn default() -> Self {
StrpTimeOptions {
date_dtype: DataType::Datetime(TimeUnit::Milliseconds, None),
fmt: None,
strict: false,
exact: false,
}
}
}