use crate::ParseCfg;
use alloc::boxed::Box;
use core::ops::RangeInclusive;
use once_cell::race::OnceBox;
static DEFAULT_DATE_PARSE_OPTIONS: OnceBox<ParseCfg> = OnceBox::new();
pub(crate) fn default_date_parse_options() -> &'static ParseCfg {
DEFAULT_DATE_PARSE_OPTIONS.get_or_init(|| Box::new(ParseCfg::default()))
}
#[cfg(feature = "locale")]
use {once_cell::race::OnceBool, sys_locale};
#[cfg(feature = "locale")]
const MONTH_FIRST_LOCALES: &[&str] = &[
"en-us", "en-ca", "en-ph", "en-bz", "en-jm", "en-tt", "en-bb", "es-do", "es-pa", "es-pr", ];
#[cfg(feature = "locale")]
static LOCALE_PREFERS_DAY_FIRST: OnceBool = OnceBool::new();
#[cfg(feature = "locale")]
pub(crate) fn locale_prefers_day_first() -> bool {
LOCALE_PREFERS_DAY_FIRST.get_or_init(|| {
sys_locale::get_locale()
.map(|locale| {
let lower = locale.to_ascii_lowercase();
if MONTH_FIRST_LOCALES.iter().any(|&m| lower.starts_with(m)) {
false
} else {
true }
})
.unwrap_or(true) })
}
pub(crate) const DIGIT_CHARS: [char; 10] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
pub(crate) const MAX_DATE_STRING_LEN: usize = 255;
pub(crate) const MIN_YEAR: i32 = -9999;
pub(crate) const MAX_YEAR: i32 = 9999;
pub(crate) const LEGACY_ORDINAL_YEAR_RANGE: RangeInclusive<i32> = 1850..=2300;
pub(crate) const PLAUSIBLE_YYYYMM_YEAR_RANGE: RangeInclusive<i32> = 1900..=2150;
pub(crate) const MJD_RANGE: RangeInclusive<i64> = 40_000..=85_000;
pub(crate) const JD_RANGE: RangeInclusive<i64> = 1_400_000..=4_000_000;
pub(crate) const NS_PER_DAY: i128 = 86_400_000_000_000;
pub(crate) const NS_PER_SEC: i128 = 1_000_000_000;
pub(crate) const AS_PER_YEAR: i128 = 31_557_600_000_000_000_000_000_000; pub(crate) const AS_PER_MONTH: i128 = 2_629_800_000_000_000_000_000_000; pub(crate) const AS_PER_WEEK: i128 = 604_800_000_000_000_000_000_000;
pub(crate) const AS_PER_DAY: i128 = 86_400_000_000_000_000_000_000;
pub(crate) const AS_PER_HOUR: i128 = 3_600_000_000_000_000_000_000;
pub(crate) const AS_PER_MINUTE: i128 = 60_000_000_000_000_000_000;