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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
//! Patterns are grouped together by order of month, day, year. This is to prevent
//! parsing different orders of dates in a single column.
pub(super) static DATE_D_M_Y: &[&str] = &[
// 8-Jul-2001
"%v", // 31-12-2021
"%d-%m-%Y", // 31-12-21
"%d-%m-%y", // 31_12_2021
"%d_%m_%Y", // 31_12_21
"%d_%m_%y",
];
pub(super) static DATE_Y_M_D: &[&str] = &[
// 2021-12-31
"%Y-%m-%d", // 21-12-21
"%y-%m-%d", // 2021_12_31
"%Y_%m_%d", // 21_12_21
"%y_%m_%d",
];
/// NOTE: don't use single letter dates like %F
/// polars parsers does not support them, so it will be slower
pub(super) static DATETIME_D_M_Y: &[&str] = &[
// --
// supported by polars' parser
// ---
// 31/12/21 12:54:48
"%d/%m/%y %H:%M:%S",
// 31-12-2021 24:58:01
"%d-%m-%Y %H:%M:%S",
// 31-04-2021T02:45:55.555000000
// milliseconds
"%d-%m-%YT%H:%M:%S.%3f",
"%d-%m-%yT%H:%M:%S.%3f",
// microseconds
"%d-%m-%YT%H:%M:%S.%6f",
// 31-04-21T02:45:55.555000000
"%d-%m-%yT%H:%M:%S.%6f",
// nanoseconds
"%d-%m-%YT%H:%M:%S.%9f",
"%d-%m-%yT%H:%M:%S.%9f",
"%d/%m/%Y 00:00:00",
"%d-%m-%Y 00:00:00",
// no times
"%d-%m-%Y",
"%d-%m-%y",
// 31/12/2021 11:54:48 PM
"%d/%m/%Y %I:%M:%S %p",
"%d-%m-%Y %I:%M:%S %p",
// 31/12/2021 11:54 PM
"%d/%m/%Y %I:%M %p",
"%d-%m-%Y %I:%M %p",
];
/// NOTE: don't use single letter dates like %F
/// polars parsers does not support them, so it will be slower
pub(super) static DATETIME_Y_M_D: &[&str] = &[
// 21/12/31 12:54:48
"%y/%m/%d %H:%M:%S",
// 2021-12-31 24:58:01
"%Y-%m-%d %H:%M:%S",
// 21/12/31 24:58:01
"%y/%m/%d %H:%M:%S",
//210319 23:58:50
"%y%m%d %H:%M:%S",
// 2019-04-18T02:45:55
// 2021/12/31 12:54:98
"%Y/%m/%d %H:%M:%S",
// 2021-12-31 24:58:01
"%Y-%m-%d %H:%M:%S",
// 2021/12/31 24:58:01
"%Y/%m/%d %H:%M:%S",
// 20210319 23:58:50
"%Y%m%d %H:%M:%S",
// 2019-04-18T02:45:55
"%Y-%m-%dT%H:%M:%S",
"%Y-%m-%dT%H:%M:%SZ",
// 2019-04-18T02:45:55.555[000000]
// nanoseconds
"%Y-%m-%d %H:%M:%S.%9f",
"%Y-%m-%dT%H:%M:%S.%9f",
// microseconds
"%Y-%m-%d %H:%M:%S.%6f",
"%Y-%m-%dT%H:%M:%S.%6f",
// milliseconds
"%Y-%m-%d %H:%M:%S.%3f",
"%Y-%m-%dT%H:%M:%S.%3f",
// no times
"%Y-%m-%d",
"%Y/%m/%d",
// 2021/12/31 11:54:48 PM
"%Y/%m/%d %I:%M:%S %p",
"%Y-%m-%d %I:%M:%S %p",
// 2021/12/31 11:54 PM
"%Y/%m/%d %I:%M %p",
"%Y-%m-%d %I:%M %p",
// --
// not supported by polars' parser
// ---
"%+",
// we cannot know this one, because polars needs to know
// the length of the parsed fmt
"%FT%H:%M:%S%.f",
];
#[derive(Eq, Hash, PartialEq, Clone, Copy, Debug)]
pub enum Pattern {
DateDMY,
DateYMD,
DatetimeYMD,
DatetimeDMY,
}