mirror of https://github.com/boa-dev/boa.git
Kevin
1 year ago
committed by
GitHub
31 changed files with 155 additions and 112 deletions
@ -1,15 +1,11 @@
|
||||
//! Implementation of the "iso8601" calendar.
|
||||
|
||||
use crate::{ |
||||
date::Date, |
||||
duration::Duration, |
||||
components::{Date, Duration, MonthDay, YearMonth}, |
||||
error::TemporalError, |
||||
fields::TemporalFields, |
||||
month_day::MonthDay, |
||||
options::{ArithmeticOverflow, TemporalUnit}, |
||||
utils, |
||||
year_month::YearMonth, |
||||
TemporalResult, |
||||
utils, TemporalResult, |
||||
}; |
||||
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 crate::{ |
||||
calendar::CalendarSlot, |
||||
instant::Instant, |
||||
components::{calendar::CalendarSlot, Instant}, |
||||
iso::{IsoDate, IsoDateSlots, IsoDateTime, IsoTime}, |
||||
options::ArithmeticOverflow, |
||||
parser::parse_date_time, |
||||
TemporalError, TemporalResult, |
||||
}; |
||||
|
||||
/// The `DateTime` struct.
|
||||
/// The native Rust implementation of `Temporal.PlainDateTime`
|
||||
#[derive(Debug, Default, Clone)] |
||||
pub struct DateTime { |
||||
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::{ |
||||
calendar::CalendarSlot, |
||||
components::calendar::CalendarSlot, |
||||
iso::{IsoDate, IsoDateSlots}, |
||||
options::ArithmeticOverflow, |
||||
TemporalResult, |
||||
}; |
||||
|
||||
/// The `MonthDay` struct
|
||||
/// The native Rust implementation of `Temporal.PlainMonthDay`
|
||||
#[derive(Debug, Default, Clone)] |
||||
pub struct MonthDay { |
||||
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}; |
||||
|
||||
/// The Temporal `PlainTime` object.
|
||||
/// The native Rust implementation of `Temporal.PlainTime`.
|
||||
#[derive(Debug, Default, Clone, Copy)] |
||||
#[allow(dead_code)] |
||||
pub struct Time { |
@ -1,13 +1,13 @@
|
||||
//! `YearMonth`
|
||||
//! This module implements `YearMonth` and any directly related algorithms.
|
||||
|
||||
use crate::{ |
||||
calendar::CalendarSlot, |
||||
components::calendar::CalendarSlot, |
||||
iso::{IsoDate, IsoDateSlots}, |
||||
options::ArithmeticOverflow, |
||||
TemporalResult, |
||||
}; |
||||
|
||||
/// The `YearMonth` struct
|
||||
/// The native Rust implementation of `Temporal.YearMonth`.
|
||||
#[derive(Debug, Default, Clone)] |
||||
pub struct YearMonth { |
||||
iso: IsoDate, |
Loading…
Reference in new issue