Javascript - overriding new Date() behavior to offset GMT -
i'm developing website uses comet transmit data web clients. application time sensitive, have graph displaying points added every second.
since web application comet driven there no real need client handle dates, should use server timestamp display information. i.e. plotted point on graph should display in tooltip server timestamp, regardless of user's timezone.
i think best approach retrieve server's timestamp using rest. measure timezone offset between server , client time, add/deduct difference , use client's timestamp display purposes.
is there way override default behavior of new date() result in me having server's timestamp local?
many thanks.
just redefine it, should work fine:
if(date) { try{ date = null; date = function() { console.log("the more things change, more stay same!"); } date(); } catch(exeption) { console.log("couldn't override date object."); } }
Comments
Post a Comment