Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upper/lower presentation format for am/pm in fromMillis #277

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading