diff --git a/src/datetime.js b/src/datetime.js index 00d80eab..01217658 100644 --- a/src/datetime.js +++ b/src/datetime.js @@ -904,6 +904,13 @@ const dateTime = (function () { if (offset === 0 && 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; }; diff --git a/test/test-suite/groups/function-fromMillis/formatDateTime.json b/test/test-suite/groups/function-fromMillis/formatDateTime.json index 96e1962d..c08a9eaf 100644 --- a/test/test-suite/groups/function-fromMillis/formatDateTime.json +++ b/test/test-suite/groups/function-fromMillis/formatDateTime.json @@ -539,6 +539,22 @@ "2018-10-21T13:05:00.000Z" ] }, + { + "function": "#fromMillis", + "category": "Upper case AM/PM presentation", + "description": "am/pm presentation should be set to uppercase AM", + "expr": "$fromMillis(1521801216617, '[F], [D]/[M]/[Y] [h]:[m]:[s] [PN]')", + "data": {}, + "result": "friday, 23/3/2018 10:33:36 AM" + }, + { + "function": "#fromMillis", + "category": "Lower case AM/PM presentation", + "description": "am/pm presentation should be set to lowercase am", + "expr": "$fromMillis(1521801216617, '[F], [D]/[M]/[Y] [h]:[m]:[s] [Pn]')", + "data": {}, + "result": "friday, 23/3/2018 10:33:36 am" + }, { "function": "#fromMillis", "category": "error",