javascript - Date Object toLocaleString not working properly -


why date , time not work syntax?

<script>      date.prototype.addhours = function (h) {         this.sethours(this.gethours() + h);         return this;     };      $(document).ready(function () {         $("#countdown").countdown({             date: date.addhours(1).tolocalestring(),             format: "on"             },              function () {                  // callback function             });     });  </script> 

but work fine:

<script>      date.prototype.addhours = function (h) {         this.sethours(this.gethours() + h);         return this;     };      $(document).ready(function () {         $("#countdown").countdown({             date: "4/5/2014 12:13:16 pm",             format: "on"             },              function () {                  // callback function             });     });  </script> 

the change on date property. fyi

date constructor, , need new instance of it

$("#countdown").countdown({     date: (new date()).addhours(1).tolocalestring(),     format: "on"     }, 

not sure if matters, note not users same string tolocalestring()


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -