1

I have problem with jquery weekcalendar demo plugin Its work in Mozilla but not in Chrome .

I Found Problem its with Datetime :

In DEMO.JS File :

  alert(new Date("2013-08-08T09:40"));

so its work with Mozilla Firefox with output Its fine

enter image description here

But in Chrome (Version 28.0.1500.95m) its not working : Wrong output :

enter image description here

So please help me out . I need same output with chrome also

HybrisHelp
  • 5,518
  • 2
  • 27
  • 65

1 Answers1

1

Proper format is

new Date("2013-08-08T09:40Z");

http://www.w3.org/TR/NOTE-datetime

If you want to play the local timezone game then you must manually calculate the offset you want and use it in the format:

new Date("2013-08-08T09:40+05:30");

It is easier to just use UTC though.

If you don't want to specify any timezone, you need to use different constructor:

new Date(2013, 7, 8, 9, 40);

This will result in an instant that is dependent on whatever timezone settings the user has on their computer.

Esailija
  • 138,174
  • 23
  • 272
  • 326
  • `@Esailija' Thanks for ans : Its work fine with `new Date("2013-08-08T09:40+05:30");` But in `Mozilla` its work without `timezone` its handle automatically So i don't understand why its not fine with `chrome ` – HybrisHelp Aug 07 '13 at 11:58
  • @ankit337 The simplest way to explain it is: when you pass crap in, you get crap out. For example, if you wrote incorrect html, then the result will appear most likely differently in every browser. – Esailija Aug 07 '13 at 12:01