jquery - Javascript Date Object's getUTC and setUTC -
i'm having little trouble wrapping head around javascript object's getutc , setutc methods.
i'm working on frontend countdown clock next shipping cuttoff using jquery plugin, tinytimer. cannot use backend scripts on platform i'm working on. timer working well, except don't know how adjust time zone
var d = new date(); /* month & time & day of week*/ var monthoftheyear = d.getmonth(); var dayofthemonth = d.getdate(); var dayoftheweek = d.getday(); /*new years day */ if( monthoftheyear == 0 && dayofthemonth == 1){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>closed today new year's day</p>"); } /*memorial day */ if( monthoftheyear == 4 && dayofthemonth >= 25 && dayoftheweek == 1){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>closed today memorial day</p>"); } /*independence day */ if( monthoftheyear == 6 && dayofthemonth == 4 ){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>closed today independence day</p>"); } /*labor day */ if( monthoftheyear == 8 && dayofthemonth <= 7 && dayoftheweek == 1){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>closed today labor day</p>"); } /*thanksgiving */ if( monthoftheyear == 10 && dayofthemonth <= 28 && dayofthemonth >= 22 && dayoftheweek == 4){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>closed today thanksgiving.</p>"); } /*day after thanksgiving */ if( monthoftheyear == 10 && dayofthemonth <= 29 && dayofthemonth >= 23 && dayoftheweek == 5){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>courier closed today day after thanksgiving.</p>"); } /*christmas */ if( monthoftheyear == 11 && dayofthemonth == 25){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>closed today christmas's day!</p>"); } /*new year's eve */ if( monthoftheyear == 11 && dayofthemonth == 31){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>closed today new year's eve!</p>"); } /* check not saturday or sunday*/ if( dayoftheweek == 0){ d.setdate(d.getdate() + 1); }else if( dayoftheweek === 6 ){ d.setdate(d.getdate() + 2); } /* set time 4:30pm */ d.sethours(16); d.setminutes(30); d.setseconds(0); /* initialize tinytimer */ $('#timer').tinytimer({ to: d });
Comments
Post a Comment