Localization support for chrono, patched to work with the latest version
Find a file
2018-12-14 10:55:47 +00:00
locales Fix pt and pt-br locales 2018-12-09 09:14:17 +00:00
src Add formatl to NaiveDateTime and fix doctests 2018-12-14 10:55:47 +00:00
tests Add formatl to NaiveDateTime and fix doctests 2018-12-14 10:55:47 +00:00
.editorconfig First version 2018-12-02 13:38:33 +00:00
.gitignore First version 2018-12-02 13:38:33 +00:00
build.rs Do not allow 2-items ampm definitions 2018-12-13 09:16:37 +00:00
Cargo.toml Add formatl to NaiveDateTime and fix doctests 2018-12-14 10:55:47 +00:00
LICENSE.txt Add license and update README 2018-12-03 08:32:59 +00:00
README.md Add usage section in the README 2018-12-14 08:35:56 +00:00
rustfmt.toml Cleanup 2018-12-05 09:12:17 +00:00

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)