Update timestamp code in javascript