Any ideas or pointers appreciated.I seem to be making it over complicated and does not handle year change either. It seems harder than I appreciated to keep it simple.
The only saving face I have thank goodness you cannot see my code. That’s a superb solution thank you. Glaringly simple when shown but I would not have thought of that, I was indeed over complicating the task. Thank you for such a fast reply, your time and knowledge is truly appreciated.
Please help me. I have been struggling with this for months !
I am storing this code in the data.js (Backend)
I want to get the number of days between the createdDate and Today. This is my code but it is not giving me anything in the item.days field in the collection.
export function Tasks_afterQuery ( item , context ) {
const createDate = item._createdDate ; var date1 = new Date ( createDate ); var date2 = new Date ();
var timeDiff = Math . abs ( date2 . getTime ()) - Math . abs ( date1 . getTime ()); // get time diff in milliseconds var diffDays = Math . ceil ( timeDiff / ( 1000 * 3600 * 24 )); // convert milliseconds to days