# JSONata expression tester does not recognize $moment() function?

**URL:** <https://discourse.nodered.org/t/jsonata-expression-tester-does-not-recognize-moment-function/53650>\
**Category:** General\
**Created:** [12 November 2021 20:46 UTC](https://discourse.nodered.org/t/jsonata-expression-tester-does-not-recognize-moment-function/53650 "2021-11-12T20:46:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [12 November 2021 20:46 UTC](https://discourse.nodered.org/t/jsonata-expression-tester-does-not-recognize-moment-function/53650/1 "2021-11-12T20:46:42Z")

</div>

I'm running the latest NR v2.1.3 and just found this oddity -- not sure if it worked on older versions:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/b/0b3497d6d610dc69ecc5c850d1af6bd000502309.png)

The `inject` node expression works fine when injected, but does not work inside the JSONata expression test window.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [12 November 2021 20:48 UTC](https://discourse.nodered.org/t/jsonata-expression-tester-does-not-recognize-moment-function/53650/2 "2021-11-12T20:48:43Z")

</div>

Yup - that's never worked. We don't load all of moment into the editor for that to work.

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [12 November 2021 20:51 UTC](https://discourse.nodered.org/t/jsonata-expression-tester-does-not-recognize-moment-function/53650/3 "2021-11-12T20:51:05Z")

</div>

Ok, so not a new issue...

Is there any documentation or reference links to what moment formats are available?  
Not that I cannot look them up for myself -- just wondering if I overlooked something in the editor.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [12 November 2021 20:55 UTC](https://discourse.nodered.org/t/jsonata-expression-tester-does-not-recognize-moment-function/53650/4 "2021-11-12T20:55:14Z")

</div>

To be frank, I regret adding moment like this. Moment itself is a deprecated library - there are lighter weight alternatives available that would be better for us. So no, the documentation is virtually non-existent as we wouldn't want to encourage its use.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [12 November 2021 22:46 UTC](https://discourse.nodered.org/t/jsonata-expression-tester-does-not-recognize-moment-function/53650/5 "2021-11-12T22:46:36Z")

</div>

Removing $moment() would break a lot of my flows, I would appreciate advance notice of any changes.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [12 November 2021 23:16 UTC](https://discourse.nodered.org/t/jsonata-expression-tester-does-not-recognize-moment-function/53650/6 "2021-11-12T23:16:42Z")

</div>

Well yes. removing it would be a major breaking change so would only happen (if at all) in 3.0 or 4.0.

Far more likely we deprecate its usage and remove reference to it from the docs in 3.0, but leave it there so flows continue to work. At the same time, we'd introduce an alternative function as the preferred replacement.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 November 2021 23:17 UTC](https://discourse.nodered.org/t/jsonata-expression-tester-does-not-recognize-moment-function/53650/7 "2021-11-26T23:17:13Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
