use chrono_tz::Tz;
use crate::util::{Locale, Utf16String};
use super::temporal_formatting_utils::TemporalFormattingError;
use super::{TemporalArrayUtils, TemporalValue};
pub struct TemporalListUtils {
array_utils: TemporalArrayUtils,
}
impl TemporalListUtils {
pub fn new(locale: Locale, default_zone_id: Tz) -> Result<Self, TemporalFormattingError> {
Ok(Self {
array_utils: TemporalArrayUtils::new(locale, default_zone_id)?,
})
}
pub fn list_format(
&self,
target: &[Option<TemporalValue>],
pattern: Option<&str>,
locale: Option<&Locale>,
) -> Result<Vec<Option<Utf16String>>, TemporalFormattingError> {
self.array_utils.array_format(target, pattern, locale)
}
pub fn list_day(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<i32>>, TemporalFormattingError> {
self.array_utils.array_day(target)
}
pub fn list_month(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<i32>>, TemporalFormattingError> {
self.array_utils.array_month(target)
}
pub fn list_year(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<i32>>, TemporalFormattingError> {
self.array_utils.array_year(target)
}
pub fn list_day_of_week(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<i32>>, TemporalFormattingError> {
self.array_utils.array_day_of_week(target)
}
pub fn list_hour(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<i32>>, TemporalFormattingError> {
self.array_utils.array_hour(target)
}
pub fn list_minute(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<i32>>, TemporalFormattingError> {
self.array_utils.array_minute(target)
}
pub fn list_second(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<i32>>, TemporalFormattingError> {
self.array_utils.array_second(target)
}
pub fn list_nanosecond(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<i32>>, TemporalFormattingError> {
self.array_utils.array_nanosecond(target)
}
pub fn list_month_name(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<Utf16String>>, TemporalFormattingError> {
self.array_utils.array_month_name(target)
}
pub fn list_month_name_short(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<Utf16String>>, TemporalFormattingError> {
self.array_utils.array_month_name_short(target)
}
pub fn list_day_of_week_name(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<Utf16String>>, TemporalFormattingError> {
self.array_utils.array_day_of_week_name(target)
}
pub fn list_day_of_week_name_short(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<Utf16String>>, TemporalFormattingError> {
self.array_utils.array_day_of_week_name_short(target)
}
pub fn list_format_iso(
&self,
target: &[Option<TemporalValue>],
) -> Result<Vec<Option<Utf16String>>, TemporalFormattingError> {
self.array_utils.array_format_iso(target)
}
}