Repository: jsonata-js/jsonata
Pull request #643 (2023-07-31 13:19:53)

Added overview of languages implementing JSONata
I couldn't find any overview of available implementations, so I created this one.
The place right under "Get JSONata" looks right for this.


aeberhart: This would address questions like #415 

Patch:
diff --git a/docs/construction.md b/docs/construction.md
index 4705ee5..81a42d5 100644
--- a/docs/construction.md
+++ b/docs/construction.md
@@ -44,7 +44,7 @@ __Examples__
 
 ## Object constructors
 
-In a similar manner to the way arrays can be constructed, JSON objects can also be constructed in the output.  At any point in a location path where a field reference is expected, a pair of braces `{}` containing key/value pairs separated by commas, with each key and value separated by a colon: `{key1: value2, key2:value2}`.  The keys and values can either be literals or can be expressions. The key must either be a string or an expression that evaluates to a string.
+In a similar manner to the way arrays can be constructed, JSON objects can also be constructed in the output.  At any point in a location path where a field reference is expected, a pair of braces `{}` containing key/value pairs separated by commas, with each key and value separated by a colon: `{key1: value1, key2:value2}`.  The keys and values can either be literals or can be expressions. The key must either be a string or an expression that evaluates to a string.
 
 When an object constructor follows an expression that selects multiple values, the object constructor will create a single object that contains a key/value pair for each of those context values.  If an array of objects is required (one for each context value), then the object constructor should immediately follow the dot '.' operator.
 
diff --git a/docs/overview.md b/docs/overview.md
index cb2ae9e..361e4a3 100644
--- a/docs/overview.md
+++ b/docs/overview.md
@@ -16,6 +16,21 @@ JSONata is a lightweight query and transformation language for JSON data. Inspir
 * Install the module from [NPM](https://www.npmjs.com/package/jsonata)
 * Fork the repo on [GitHub](https://github.com/jsonata-js/jsonata)
 
+## Implementations of JSONata
+
+The following are known implementations of JSONata in addition to the primary implementation in JavaScript in the above repo.
+
+|Language|Link|Notes|JSONata version|
+|---|---|---|---|
+|C|https://github.com/qlyoung/jsonata-c|Runs JSONata in embedded JS engine|1.8.3|
+|Go|https://github.com/blues/jsonata-go|Native implementation|1.5.4|
+|Go|https://github.com/yxuco/gojsonata|Native implementation| |
+|Java|https://github.com/IBM/JSONata4Java|Native implementation| |
+|Java|https://github.com/dashjoin/jsonata-java|Native port of reference|2.0.3|
+|.NET|https://github.com/mikhail-barg/jsonata.net.native|Native implementation|1.8.5|
+|Python|https://github.com/qlyoung/pyjsonata|API bindings based on C bindings|1.8.3|
+|Rust|https://github.com/johanventer/jsonata-rust|Implementation work in progress| |
+
 ## Find out more
 
 * Introduction at [London Node User Group meetup](https://www.youtube.com/watch?v=TDWf6R8aqDo)
diff --git a/src/datetime.js b/src/datetime.js
index 00d80ea..0121765 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;
         };


Test patch:
diff --git a/test/test-suite/groups/function-fromMillis/formatDateTime.json b/test/test-suite/groups/function-fromMillis/formatDateTime.json
index 96e1962..c08a9ea 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",