Nan error for variable in Table

Hi ,

i am trying to display in a table a date value that is defined by a <$let> widget

i am using TiddlyTools for TW5 v5.2.5 — Small Tools for Big Ideas!™

the date value is a subtraction of 2 other dates set by the date picker tool, parsed to Unix timing, added together then converted back to normal date format



date1={{{ [{!!endd1}parsedate[unixtime]] }}} 
date2={{{[{!!endd2}parsedate[unixtime]] }}}
date3 = {{{[<date1>subtract<date2>]}}} 


<tr><th>title</th><th>due date</th><th>status</th></tr>

<$list filter="[tidtype[task]status[In House]!tag[test]sort[endd1]]">
<tr><td><$view field="title" />
</td><td><$view field=status/></td></tr>

its defaulting to 1970-01-01 which i guess is 0 in unix time ,i believe the variables the calculation “date4” is based on are not read properly as they all return NAN when called speratley , which as i understood is maybe some Html to wikitext conversion issue, i tried to use the wikify widget but got lost honestly .

can someone please help me as to wether this is to be solved with the wikify widget or not , an if yes , how to use it in this context

thanks again :slight_smile:

edit: added some exctra information and formatted the code

You should mention what tool or plugin you’re using for dates, and what you are trying to achieve. We don’t know from this example even what variable is meant to be expressed for “due date”.

This part looks wrong, since the filter expression has only one set of square brackets.

date3 = {{{[subtract]}}}

Good luck!


sorry about that, submitted in a hurry and forgot to use preformatting ,didn’t notice that and the code is all jumbled :slight_smile:

i have edited the post and tidied it up

thank you

It might help to know the contents of endd1 and endd2.

Offhand, it looks like date3 will end up holding the number of days between endd1 and endd2, which will be a very small number and will indeed likely convert to something very near the start of unix time. That’s probably not what you meant to do. Also, it’s possible that date3 is negative. So it would be helpful to see the contents of date3.

Unixtime values are expressed as a signed-integer number of milliseconds since 1970-01-01.

Negative values are times before that date.

As @Mark_S has already noted, date3 in your calculations is likely to be a very small number.



What should the result of this operation be? Let’s say endd1 is 2023-02-01 and endd2 is 2023-03-01, then with your code date3 would be the number of milliseconds between these dates, but what would you expect date4 value to be?


Yes, Date3 would be the difference.

This would mean the difference on the same day would be a total of hours and milliseconds but in other cases the difference could years or decades.

  • Has anyone explored converting the differences in unix times into usable periods of time?. Not unlike the relativedate format does for regular dates.


I doubt translating a difference would be accurate, because a difference between dates is relative but does not have a starting point, as would be needed to compute months, with leap years or even leap seconds. Let’s say the difference is 34 days of 24 hours. How many months is that? What is the length of an average month?
I believe date differences can only be computed between two dates, and it’s not a trivial task.


I understand but many remain valid such as;

  • Hours /minsbetween two date/times
  • Days between two dates
  • Weeks between two dates (days/7)

Just the first two Hours and days will be helpful in many cases.

However as you suggest there will be cases where you want to add or subtract the difference from a specific date so that it becomes relative to that date, hence one can find months between etc…

  • The use of unixtime makes this a lot simpler as it allows simple addition or subtraction of days, weeks across month and year boundaries.
  • In other cases you can operate on the Month or year values found in a regular date (except February 29th) knowing there are always 12 months.

Thank you for all your reponses

you are right , i messed up… so sorry , the code i provided is wrong. i am trying to figure out what went wrong, and will either come back with a more coherent question , or will cancel topic in the next couple of days

sorry about that

Hi again,

It was in error on my side declaring the variables outside the filter which caused the values not to be recognized , i was able to fix that and overcome the error

sorry again for the confusion , and thank you for your help as always,

i guess i will cancel the topic now…

edit : or perhaps its and admin decision as it seems i cant delete the topic.

No need, it all forms part of our rich history :nerd_face:

1 Like