Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- var millisDigits = 0; //How many digits the milliseconds should have
- const date= "2026-06-24T11:00:00-04:00"; //Date to count up from
- //-------------------------
- var timer = 0;
- var mins;
- var seconds;
- var hours;
- var days;
- export function update(value) {
- if(timer<0){
- console.log(timer)
- timer+= engine.frametime;
- seconds = Math.abs(timer%60|0);
- mins = Math.abs((timer/60)%60|0);
- hours = Math.abs((timer/3600)%24|0);
- days = Math.abs(timer/86400|0);
- if(mins<10){
- mins = "0"+mins;
- }
- if(seconds <10){
- seconds = "0"+seconds;
- }
- if(hours<10){
- hours = "0"+hours;
- }
- if(days<10){
- days = "0"+days;
- }
- return days+":"+hours+":"+mins+":"+seconds;
- }
- return "00:00:00:00";
- }
- /**
- * @param {String} value - for property 'text'
- */
- export function init(value) {
- timer= (new Date().getTime()-new Date(date).getTime())/1000;
- return value;
- }
Advertisement
Add Comment
Please, Sign In to add comment