How do I show the (whole) number of days the item was created and display it in other coulmumn named : active days. I want the counter to stop after the item is closed
You can use moment.js
Moment will allow you to use something called .fromNow()
You can pass your date into moment: moment('15/08/2017').fromNow('DD'); which should return: 1 day.
Pretty cool library and worth a check!
Also worth a mention that it can recognise most if not all date and time formats. You may need to use a locale depending on your timezone but should do the job nicely.
Hope this helped?
You can follow the post here.
Basically we cannot use Calculated column as it only gets updated when the item is updated. You may need to write a schedule job/workflow to calculate the number of days based on today's date and item creation date and status of the item i.e. "Closed".
The timer job should run daily to calculate the number of days and update the result in another SharePoint field. I generally implement timer job using C# Server Side Console program and read the items in the list one by one.
Use the DATEDIF function to perform this calculation.