# Disable function code warning

**URL:** https://discourse.nodered.org/t/disable-function-code-warning/98360
**Category:** General
**Tags:** function-node
**Created:** [29 July 2025 12:23 UTC](https://discourse.nodered.org/t/disable-function-code-warning/98360 "2025-07-29T12:23:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![remsfn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/remsfn/32/101823_2.png) [@remsfn](https://discourse.nodered.org/u/remsfn)
#### Post date: [29 July 2025 12:23 UTC](https://discourse.nodered.org/t/disable-function-code-warning/98360/1 "2025-07-29T12:23:30Z")

</div>

I am using Node red V4.0.9 and the following code

`const delta_ms = new Date() - new Date(machines_buffer.timestamp);`  
genrate a warning but do work!

> The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.(2362)

is it possible to remove this warning ?

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [29 July 2025 12:30 UTC](https://discourse.nodered.org/t/disable-function-code-warning/98360/2 "2025-07-29T12:30:38Z")

</div>

I removed it:

```auto
const delta_ms = new Date().getTime() - new Date(machines_buffer.timestamp).getTime();

```

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [29 July 2025 14:42 UTC](https://discourse.nodered.org/t/disable-function-code-warning/98360/3 "2025-07-29T14:42:36Z")

</div>

> [@remsfn](#):
>
> genrate a warning but do work!

This is a known limitation of the Monaco editor component from Microsoft. `new Date()` strictly speaking returns a JavaScript `date` object, not a number. Even though a `date` object IS a number! Sometimes JavaScript is just weird. 😃

jbudd has shown one way to fix it. Another way would be:

```javascript
const delta_ms = Number(new Date()) - Number(new Date(machines_buffer.timestamp));

```

---

<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: [12 August 2025 14:43 UTC](https://discourse.nodered.org/t/disable-function-code-warning/98360/4 "2025-08-12T14:43:18Z")

</div>

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