Localization support for chrono, patched to work with the latest version
Find a file
2024-05-12 20:59:00 +05:30
.github/workflows chore(ci): remove unecessary --lib flag for cargo test 2023-09-13 22:37:56 +05:30
.vscode chore(vscode): include settings config 2023-09-13 18:31:00 +05:30
locales fix(fi): ommited quote in JSON syntaxx 2024-01-14 14:03:41 +05:30
src chore(crate): bump version 2024-05-12 20:59:00 +05:30
tests chore(tests): include test for fi (finnish) locale 2024-01-08 20:12:46 +05:30
.editorconfig First version 2018-12-02 13:38:33 +00:00
.gitignore First version 2018-12-02 13:38:33 +00:00
build.rs feat: support latest version chrono 2024-05-12 20:56:29 +05:30
Cargo.toml chore(crate): bump version 2024-05-12 20:59:00 +05:30
LICENSE.txt chore(LICENSE): update license to include myself 2024-01-08 19:49:09 +05:30
README.md chore(crate): bump version 2024-05-12 20:59:00 +05:30
rustfmt.toml Cleanup 2018-12-05 09:12:17 +00:00

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.6"

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).