From 689a22e51a7f21b0b2f055892dc3b015ce36548c Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Sun, 23 Jul 2023 13:57:09 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20ISO=208601=20date=20and=20tim?= =?UTF-8?q?e=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagetop/Cargo.toml | 1 + pagetop/src/datetime.rs | 4 ++++ pagetop/src/lib.rs | 4 ++++ pagetop/src/prelude.rs | 2 ++ 4 files changed, 11 insertions(+) create mode 100644 pagetop/src/datetime.rs diff --git a/pagetop/Cargo.toml b/pagetop/Cargo.toml index a586c23e..0ad6827d 100644 --- a/pagetop/Cargo.toml +++ b/pagetop/Cargo.toml @@ -33,6 +33,7 @@ sqlite = ["database", "sea-orm/sqlx-sqlite"] [dependencies] async-trait = "0.1.68" +chrono = "0.4.26" concat-string = "1.0.1" figlet-rs = "0.1.5" itoa = "1.0.6" diff --git a/pagetop/src/datetime.rs b/pagetop/src/datetime.rs new file mode 100644 index 00000000..618ce05c --- /dev/null +++ b/pagetop/src/datetime.rs @@ -0,0 +1,4 @@ +//! PageTop uses the [Chrono](https://docs.rs/chrono) Rust library to add +//! [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time related data. + +pub use chrono::prelude::*; diff --git a/pagetop/src/lib.rs b/pagetop/src/lib.rs index 36892954..96507a3a 100644 --- a/pagetop/src/lib.rs +++ b/pagetop/src/lib.rs @@ -22,6 +22,8 @@ //! //! * HTML en código ([`html`]). //! +//! * [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time handling ([`datetime`]). +//! //! * Acceso unificado y normalizado a base de datos ([`db`]). //! //! * Tipos y funciones esenciales para crear acciones, componentes, módulos y temas ([`core`]). @@ -135,6 +137,8 @@ pub mod trace; pub mod locale; // HTML en código. pub mod html; +// Date and time for PageTop. +pub mod datetime; // Acceso a base de datos. #[cfg_attr(docsrs, doc(cfg(feature = "database")))] diff --git a/pagetop/src/prelude.rs b/pagetop/src/prelude.rs index e61d2df8..c6c62f7a 100644 --- a/pagetop/src/prelude.rs +++ b/pagetop/src/prelude.rs @@ -22,6 +22,8 @@ pub use crate::locale::*; pub use crate::html::*; +pub use crate::datetime::*; + #[cfg(feature = "database")] pub use crate::{db, db::*, migration_item, pub_migration};