#date-time #date #time #calendar #latest-version #month #date-format

chrono_lc

Localised date and time formatting library for Rust, based on chrono

5 releases

new 0.1.7 May 12, 2024
0.1.6 May 12, 2024
0.1.5 Jan 14, 2024
0.1.4 Sep 19, 2023
0.1.3 Sep 6, 2023

#136 in Date and time

Download history 27/week @ 2024-01-26 27/week @ 2024-02-02 1/week @ 2024-02-09 35/week @ 2024-02-16 53/week @ 2024-02-23 109/week @ 2024-03-01 169/week @ 2024-03-08 54/week @ 2024-03-15 48/week @ 2024-03-22 89/week @ 2024-03-29 149/week @ 2024-04-05 242/week @ 2024-04-12 311/week @ 2024-04-19 44/week @ 2024-04-26 68/week @ 2024-05-03 473/week @ 2024-05-10

936 downloads per month
Used in 3 crates (via lune-std-datetime)

MIT/Apache

22KB
452 lines

chrono-lc

This crate allows to format chrono dates with localized months and week days. Backwards comptible fork of Alex-PK/chrono-locale, now works with the latest version of chrono.

Usage

Include the dependency in Cargo.toml:

[dependencies]
chrono = "0.4"
chrono_lc = "0.1.7"

Import the required modules into lib.rs or main.rs:

use chrono::prelude::*;
use chrono_lc::LocaleDate;

Note You can choose to import just parts of chrono instead of the whole prelude. Please see chrono's documentation.

To format a chrono Date or DateTime object, you can use the formatl method:

let dt = FixedOffset::east_opt(34200)
 .unwrap()
 .with_ymd_and_hms(2001, 7, 8, 0, 34, 59)
 .unwrap()
 .with_nanosecond(1_026_490_708)
 .unwrap();

println!("{}", dt.formatl("%c", "fr"));

Warning All of chrono's formatting placeholders work except for %3f, %6f and %9f (but %.3f, %.6f and %.9f work normally).

Dependencies

~1–2.1MB
~27K SLoC