# NR complains about incorrect javascript code - but its not

**URL:** https://discourse.nodered.org/t/nr-complains-about-incorrect-javascript-code-but-its-not/54916
**Category:** General
**Tags:** function-node
**Created:** [9 December 2021 09:01 UTC](https://discourse.nodered.org/t/nr-complains-about-incorrect-javascript-code-but-its-not/54916 "2021-12-09T09:01:49Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)
#### Post date: [9 December 2021 09:16 UTC](https://discourse.nodered.org/t/nr-complains-about-incorrect-javascript-code-but-its-not/54916/2 "2021-12-09T09:16:25Z")

</div>

Hello Haegar,

read this thread that i think is related

> [@Monaco editor does not allow subraction of dates](https://discourse.nodered.org/t/monaco-editor-does-not-allow-subraction-of-dates/53052):
>
> I am not sure where to report this. When using the Monaco editor this code, in a function node, generates an error. const d1 = new Date() const d2 = new Date(d1.getTime() + 1000) msg.payload = d2 - d1 return msg; Hovering over d2 in the third line shows: [image]

---

_[View the full topic](https://discourse.nodered.org/t/nr-complains-about-incorrect-javascript-code-but-its-not/54916)._
