mde / timezone-js

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

toString() ignores 'h' (12 hour format) #91

Closed nareshbhatia closed 11 years ago

nareshbhatia commented 11 years ago

In issue #83, it was mentioned that toString() supports the following tokens:

y: year d: date m: minute s: second S: millisecond M: month. Note: MM will be the numeric representation (e.g February is 02) but MMM will be text representation (e.g February is Feb) k: AM/PM H: hour 'h': 12 hour format E: day Z: timezone abbreviation

I tried to use the 'h' token today and it is completely ignored (the output simply shows the letter 'h').

longlho commented 11 years ago

example?

nareshbhatia commented 11 years ago
var tzdate = new timezoneJS.Date(new Date(), 'America/Chicago');
console.log(tzdate.toString('hh:mm:ss k Z')); // puts out 'hh'
console.log(tzdate.toString('HH:mm:ss k Z')); // works fine

I looked at the code for toString(), there is a case for 'H" but nothing for 'h'.

longlho commented 11 years ago

Hmm can't seem to reproduce it. Are you sure you have the latest greatest git master? We haven't released the version that supports 'h' yet. Check out https://github.com/mde/timezone-js/blob/master/spec/date.spec.js last test you'll see an example

nareshbhatia commented 11 years ago

Aha, I am using the latest tagged version (0.4.4) - that explains it.

How do I build the master branch? Haven't used Jake before, but when I run it, I get the following error:

$ jake test jake aborted. Error: 'jasmine-node' is not recognized as an internal or external command. operable program or batch file. (See full trace by running task with --trace)

longlho commented 11 years ago

@mde can you push 0.4.5?

mde commented 11 years ago

v0.4.5 published.

nareshbhatia commented 11 years ago

Works like a charm! Thank you.