diff --git a/jquery.localtime.jquery.json b/jquery.localtime.jquery.json index daac47a..f387346 100644 --- a/jquery.localtime.jquery.json +++ b/jquery.localtime.jquery.json @@ -11,7 +11,7 @@ "formatting", "ISO8601" ], - "version": "0.7.1", + "version": "0.8.0-SNAPSHOT", "author": { "name": "Greg Thomas" }, diff --git a/src/jquery.localtime.js b/src/jquery.localtime.js index 8deceb9..7b827e2 100644 --- a/src/jquery.localtime.js +++ b/src/jquery.localtime.js @@ -112,8 +112,10 @@ } break; case "a": - case "tt": formattedDate += (hour >= 12) ? "PM" : "AM"; break; - case "t": formattedDate += (hour >= 12) ? "P" : "A"; break; + case "TT": formattedDate += (hour >= 12) ? "PM" : "AM"; break; + case "tt": formattedDate += (hour >= 12) ? "pm" : "am"; break; + case "T": formattedDate += (hour >= 12) ? "P" : "A"; break; + case "t": formattedDate += (hour >= 12) ? "p" : "a"; break; case "z": formattedDate += tzSign + parseInt(tzOffset / 60, 10); break; diff --git a/test/jquery.localtime_test.js b/test/jquery.localtime_test.js index 75c012d..4e9ee9f 100644 --- a/test/jquery.localtime_test.js +++ b/test/jquery.localtime_test.js @@ -180,9 +180,15 @@ }); test("AM/PM format 2", function() { $.localtime.setFormat("t"); + equal("a", $.localtime.toLocalTime("2011-01-03 08:39:30.003Z") ); + equal("p", $.localtime.toLocalTime("2011-01-03 16:39:30.003Z") ); + $.localtime.setFormat("tt"); + equal("am", $.localtime.toLocalTime("2011-01-03 08:39:30.003Z") ); + equal("pm", $.localtime.toLocalTime("2011-01-03 16:39:30.003Z") ); + $.localtime.setFormat("T"); equal("A", $.localtime.toLocalTime("2011-01-03 08:39:30.003Z") ); equal("P", $.localtime.toLocalTime("2011-01-03 16:39:30.003Z") ); - $.localtime.setFormat("tt"); + $.localtime.setFormat("TT"); equal("AM", $.localtime.toLocalTime("2011-01-03 08:39:30.003Z") ); equal("PM", $.localtime.toLocalTime("2011-01-03 16:39:30.003Z") ); });