mde / timezone-js

DEPRECATED: Timezone-enabled JavaScript Date object. Uses Olson zoneinfo files for timezone data.
824 stars 182 forks source link

12/24 hour formating in toString() #5

Closed stevedh closed 12 years ago

stevedh commented 12 years ago

In date.js:236, you compute the hours for the toString format like:

var hou = this.getHours() || 12;

This means hour 0 and hour 12 are displayed the same way, which doesn't seem like what you want given that toString otherwise shows the time in 24-hour time. It causes confusing results like those below. I just removed the || 12; that seems like what is expected.

> point.setTime(1326846063000); point.toString()
"2012-1-18 12:21:03"

> point.setTime(1326846063000 + (3600 * 1000*12)); point.toString()
"2012-1-18 12:21:03"
mde commented 12 years ago

Could you put this in a pull request? I'll definitely merge it. Thanks!