U can using the Unixtimestamp.
U need to save the unixtimestamp as webstorage-localvalue.
Then compare that saved unixtimestamp with the current unixtimestamp.
U can do that by setting a "global variable" to the current unixtimestamp while substracting the webstorage-saved unixtimestamp.
Every tick: set global variable to date.getunixtimestamp-webstorage.localvalue("save unixtimestamp")
The key is to calculate the data "from" that global variable.
So u can calculate the weeks/days/hours/minutes/seconds.
The global variable is set as the "difference" between past time and present time.
If i am correct u can calculate the days by dividing that "difference" by 864.
That leaves u with a big number which u would need to set to "floor" or "int" to get only the number before the (.)
Maybe not everything i type here is spot on because im not at my pc right now, but u get the general idea.