mirror of https://github.com/boa-dev/boa.git
Kevin
11 months ago
committed by
GitHub
31 changed files with 155 additions and 112 deletions
@ -1,15 +1,11 @@ |
|||||||
//! Implementation of the "iso8601" calendar.
|
//! Implementation of the "iso8601" calendar.
|
||||||
|
|
||||||
use crate::{ |
use crate::{ |
||||||
date::Date, |
components::{Date, Duration, MonthDay, YearMonth}, |
||||||
duration::Duration, |
|
||||||
error::TemporalError, |
error::TemporalError, |
||||||
fields::TemporalFields, |
fields::TemporalFields, |
||||||
month_day::MonthDay, |
|
||||||
options::{ArithmeticOverflow, TemporalUnit}, |
options::{ArithmeticOverflow, TemporalUnit}, |
||||||
utils, |
utils, TemporalResult, |
||||||
year_month::YearMonth, |
|
||||||
TemporalResult, |
|
||||||
}; |
}; |
||||||
use std::any::Any; |
use std::any::Any; |
||||||
|
|
@ -1,17 +1,16 @@ |
|||||||
//! Temporal implementation of `DateTime`
|
//! This module implements `DateTime` any directly related algorithms.
|
||||||
|
|
||||||
use std::str::FromStr; |
use std::str::FromStr; |
||||||
|
|
||||||
use crate::{ |
use crate::{ |
||||||
calendar::CalendarSlot, |
components::{calendar::CalendarSlot, Instant}, |
||||||
instant::Instant, |
|
||||||
iso::{IsoDate, IsoDateSlots, IsoDateTime, IsoTime}, |
iso::{IsoDate, IsoDateSlots, IsoDateTime, IsoTime}, |
||||||
options::ArithmeticOverflow, |
options::ArithmeticOverflow, |
||||||
parser::parse_date_time, |
parser::parse_date_time, |
||||||
TemporalError, TemporalResult, |
TemporalError, TemporalResult, |
||||||
}; |
}; |
||||||
|
|
||||||
/// The `DateTime` struct.
|
/// The native Rust implementation of `Temporal.PlainDateTime`
|
||||||
#[derive(Debug, Default, Clone)] |
#[derive(Debug, Default, Clone)] |
||||||
pub struct DateTime { |
pub struct DateTime { |
||||||
iso: IsoDateTime, |
iso: IsoDateTime, |
@ -0,0 +1,46 @@ |
|||||||
|
//! The primary date-time components provided by Temporal.
|
||||||
|
//!
|
||||||
|
//! The below components are the main primitives of the `Temporal` specification:
|
||||||
|
//! - `Date` -> `PlainDate`
|
||||||
|
//! - `DateTime` -> `PlainDateTime`
|
||||||
|
//! - `Time` -> `PlainTime`
|
||||||
|
//! - `Duration` -> `Duration`
|
||||||
|
//! - `Instant` -> `Instant`
|
||||||
|
//! - `MonthDay` -> `PlainMonthDay`
|
||||||
|
//! - `YearMonth` -> `PlainYearMonth`
|
||||||
|
//! - `ZonedDateTime` -> `ZonedDateTime`
|
||||||
|
//!
|
||||||
|
//! The Temporal specification, along with this implementation aims to provide
|
||||||
|
//! full support for time zones and non-gregorian calendars that are compliant
|
||||||
|
//! with standards like ISO 8601, RFC 3339, and RFC 5545.
|
||||||
|
|
||||||
|
// TODO: Expand upon above introduction.
|
||||||
|
|
||||||
|
pub mod calendar; |
||||||
|
pub mod tz; |
||||||
|
|
||||||
|
mod date; |
||||||
|
mod datetime; |
||||||
|
pub(crate) mod duration; |
||||||
|
mod instant; |
||||||
|
mod month_day; |
||||||
|
mod time; |
||||||
|
mod year_month; |
||||||
|
mod zoneddatetime; |
||||||
|
|
||||||
|
#[doc(inline)] |
||||||
|
pub use date::Date; |
||||||
|
#[doc(inline)] |
||||||
|
pub use datetime::DateTime; |
||||||
|
#[doc(inline)] |
||||||
|
pub use duration::Duration; |
||||||
|
#[doc(inline)] |
||||||
|
pub use instant::Instant; |
||||||
|
#[doc(inline)] |
||||||
|
pub use month_day::MonthDay; |
||||||
|
#[doc(inline)] |
||||||
|
pub use time::Time; |
||||||
|
#[doc(inline)] |
||||||
|
pub use year_month::YearMonth; |
||||||
|
#[doc(inline)] |
||||||
|
pub use zoneddatetime::ZonedDateTime; |
@ -1,13 +1,13 @@ |
|||||||
//! `MonthDay`
|
//! This module implements `MonthDay` and any directly related algorithms.
|
||||||
|
|
||||||
use crate::{ |
use crate::{ |
||||||
calendar::CalendarSlot, |
components::calendar::CalendarSlot, |
||||||
iso::{IsoDate, IsoDateSlots}, |
iso::{IsoDate, IsoDateSlots}, |
||||||
options::ArithmeticOverflow, |
options::ArithmeticOverflow, |
||||||
TemporalResult, |
TemporalResult, |
||||||
}; |
}; |
||||||
|
|
||||||
/// The `MonthDay` struct
|
/// The native Rust implementation of `Temporal.PlainMonthDay`
|
||||||
#[derive(Debug, Default, Clone)] |
#[derive(Debug, Default, Clone)] |
||||||
pub struct MonthDay { |
pub struct MonthDay { |
||||||
iso: IsoDate, |
iso: IsoDate, |
@ -1,8 +1,8 @@ |
|||||||
//! Temporal Time Representation.
|
//! This module implements `Time` and any directly related algorithms.
|
||||||
|
|
||||||
use crate::{iso::IsoTime, options::ArithmeticOverflow, TemporalResult}; |
use crate::{iso::IsoTime, options::ArithmeticOverflow, TemporalResult}; |
||||||
|
|
||||||
/// The Temporal `PlainTime` object.
|
/// The native Rust implementation of `Temporal.PlainTime`.
|
||||||
#[derive(Debug, Default, Clone, Copy)] |
#[derive(Debug, Default, Clone, Copy)] |
||||||
#[allow(dead_code)] |
#[allow(dead_code)] |
||||||
pub struct Time { |
pub struct Time { |
@ -1,13 +1,13 @@ |
|||||||
//! `YearMonth`
|
//! This module implements `YearMonth` and any directly related algorithms.
|
||||||
|
|
||||||
use crate::{ |
use crate::{ |
||||||
calendar::CalendarSlot, |
components::calendar::CalendarSlot, |
||||||
iso::{IsoDate, IsoDateSlots}, |
iso::{IsoDate, IsoDateSlots}, |
||||||
options::ArithmeticOverflow, |
options::ArithmeticOverflow, |
||||||
TemporalResult, |
TemporalResult, |
||||||
}; |
}; |
||||||
|
|
||||||
/// The `YearMonth` struct
|
/// The native Rust implementation of `Temporal.YearMonth`.
|
||||||
#[derive(Debug, Default, Clone)] |
#[derive(Debug, Default, Clone)] |
||||||
pub struct YearMonth { |
pub struct YearMonth { |
||||||
iso: IsoDate, |
iso: IsoDate, |
Loading…
Reference in new issue