How can a solve a NaN text in custom App

  • 16 October 2018
  • 6 replies


This is my first custom App. I'm trying to display a simple calculation. 

I took ticket creation time, then substract it from present time (now), and want to display the result. 

That result always displays: "NaN". 

What do you recommend?

This is part of code: 

const right_now = new Date();

const diff = (right_now - data.ticket.created_at)/1000;


and this is HTML Template:



    <script src=""></script>

    <script src=""></script>

    <script src="app.js"></script>

    <link rel="stylesheet" type="text/css" href="style.css">

    <link rel="stylesheet" type="text/css" href="">



    <div class="fw-widget-wrapper">

      <div class="logo"></div>

      <div id="apptext"></div>




6 replies



The value of  data.ticket.created_at  is a datetime ISO string. You cannot subtract a string from the Date object instance, thats why the NaN.

You can get a date object for the created_at by doing  new Date(data.ticket.created_at and find the diff after. Finding diff of dates in JS could be a little tricky depending on what exactly you need. Here's a Stackoverflow thread on Date diff to get you started

I am facing this issue for the last four weeks and indeed to find a deffrient way to fix this issue but could not Get the resolving.

Userlevel 1

Hmmm no idea about NAn

Userlevel 1

Ive been struggling about this too

Hi @Samon87 


We understand that you are still facing issues. Could you please write to with your account URL and the details of the APP so that we can help you with this? 




Please feel free to reach us with your custom requirements to so that one of our support ninjas can loop you to the right person to help you build the custom app.