Skip to content

Commit

Permalink
Inline the value of %r in T_FMT
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jan 26, 2024
1 parent b77fdd4 commit 457413f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion generate-api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ fn validate_and_fix_t_fmt_ampm(objects: &mut Vec<Object>) {

/// In some locales `D_T_FMT` refers to other items:
/// to `D_FMT` with `%x`, `T_FMT` with `%X`, and/or `T_FMT_AMPM` with `%r`.
/// In the same way `T_FMT` can refer `T_FMT_AMPM` with `%r`.
/// Inlining these strings simplifies the implementation of the strftime parser in chrono.
fn validate_and_fix_d_t_fmt(objects: &mut Vec<Object>) {
for object in objects.iter_mut() {
Expand All @@ -141,7 +142,7 @@ fn validate_and_fix_d_t_fmt(objects: &mut Vec<Object>) {
}
for (key, ref mut value) in object.values.iter_mut() {
match (key.as_str(), value) {
("d_t_fmt", vec) => {
("d_t_fmt", vec) | ("t_fmt", vec) => {
if let Value::String(ref val) = vec[0] {
let d_t_fmt = val
.replace("%x", &d_fmt)
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Git LFS file not shown

0 comments on commit 457413f

Please sign in to comment.