Skip to content

Commit

Permalink
Add upper/lower presentation format for am/pm in fromMillis
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Woodgate committed Sep 28, 2023
1 parent 3990d13 commit 531774b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,13 @@ private static String formatComponent(LocalDateTime date, SpecPart markerSpec, i
if (offset == 0 && markerSpec.presentation2 != null && markerSpec.presentation2 == 't') {
componentValue = "Z";
}
} else if (markerSpec.component == 'P') {
// §9.8.4.7 Formatting Other Components
// Formatting P for am/pm
// getDateTimeFragment() always returns am/pm lower case so check for UPPER here
if (markerSpec.names == tcase.UPPER) {
componentValue = componentValue.toUpperCase();
}
}
return componentValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ public static Collection<Object[]> data() {
// { "$fromMillis(1483272000000, \"Week: [w] of [xNn]\")","\"Week: 5 of December\"",null},
// { "$fromMillis(1533038400000, \"Week: [w] of [xNn]\")","\"Week: 1 of August\"",null},
// { "$fromMillis(1419940800000, \"Week: [w] of [xNn]\")","\"Week: 1 of January\"",null},
{
"$fromMillis(1521801216617, \"[F], [D]/[M]/[Y] [h]:[m]:[s] [PN]\")", "\"friday, 23/3/2018 10:33:36 AM\"", null
},
{
"$fromMillis(1521801216617, \"[F], [D]/[M]/[Y] [h]:[m]:[s] [Pn]\")", "\"friday, 23/3/2018 10:33:36 am\"", null
},
});
}

Expand Down

0 comments on commit 531774b

Please sign in to comment.