#date-time #date #time #calendar

chrono_locale

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

2 releases

Uses old Rust 2015

0.1.1 Dec 14, 2018
0.1.0 Dec 14, 2018

#450 in Date and time

Download history 41/week @ 2023-12-13 24/week @ 2023-12-20 5/week @ 2023-12-27 15/week @ 2024-01-03 45/week @ 2024-01-10 39/week @ 2024-01-17 73/week @ 2024-01-24 61/week @ 2024-01-31 112/week @ 2024-02-07 171/week @ 2024-02-14 65/week @ 2024-02-21 59/week @ 2024-02-28 51/week @ 2024-03-06 30/week @ 2024-03-13 34/week @ 2024-03-20 34/week @ 2024-03-27

167 downloads per month
Used in mfek-ipc

MIT/Apache

21KB
420 lines

chrono-locale

This crate allows to format chrono dates with localized months and week days.

It's in early development and everything could change. Use with caution!

Usage

Put this in your Cargo.toml:

[dependencies]
chrono = "0.4"
chrono_locale = "0.1"

Then put this in your lib.rs or main.rs:

extern crate chrono;
extern crate chrono_locale;

use chrono::prelude::*;
use chrono_locale::LocaleDate;

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(34200).ymd(2001, 7, 8).and_hms_nano(0, 34, 59, 1_026_490_708);
println!("{}", dt.formatl("%c", "fr"));

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

Dependencies

~1–1.4MB
~23K SLoC