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

chrono_lc

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

3 releases

0.1.5 Jan 14, 2024
0.1.4 Sep 19, 2023
0.1.3 Sep 6, 2023

#173 in Date and time

Download history 20/week @ 2024-01-06 115/week @ 2024-01-13 18/week @ 2024-01-20 30/week @ 2024-01-27 23/week @ 2024-02-03 3/week @ 2024-02-10 47/week @ 2024-02-17 43/week @ 2024-02-24 114/week @ 2024-03-02 184/week @ 2024-03-09 33/week @ 2024-03-16 54/week @ 2024-03-23 90/week @ 2024-03-30 189/week @ 2024-04-06 239/week @ 2024-04-13 266/week @ 2024-04-20

793 downloads per month
Used in 2 crates (via lune)

MIT/Apache

21KB
423 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.5"

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.3MB
~27K SLoC