Skip to content

Commit

Permalink
Fixing issue #16 #16
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Cantero committed Nov 2, 2011
1 parent 8c33514 commit a566126
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ GPL

=== Contributors

Thanks to albertjan, christopherstott, cipa, dahdread, docchang, eemeyer, jafin, jakemonO, jharting, kitto, larryzhao, leesolutions, nashg842
Thanks to albertjan, christopherstott, cipa, dahdread, docchang, eemeyer, gwilson2151, jafin, jakemonO, jharting, kitto, larryzhao, leesolutions, nashg842
5 changes: 5 additions & 0 deletions Test.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ <h1>JavaScript unit test file</h1>
assertEqual(11, $.format.date('Mon Feb 28 2011 17:45:00 GMT-0400 (Eastern Daylight Time)', 'yy'));
assertEqual(12, $.format.date('Mon Feb 28 20112 17:45:00 GMT-0400 (Eastern Daylight Time)', 'yy'));
assertEqual('13.01.10', $.format.date('Wed Jan 13 10:43:41 CET 2010', 'dd.MM.yy'));
}},
testShortHour: function() { with(this) {
assertEqual('5', $.format.date('Mon Feb 28 2011 17:45:00 GMT-0400 (Eastern Daylight Time)', 'h'));
assertEqual('5', $.format.date('Mon Feb 28 20112 17:45:00 GMT-0400 (Eastern Daylight Time)', 'h'));
assertEqual('13.01.10 10', $.format.date('Wed Jan 13 10:43:41 CET 2010', 'dd.MM.yy h'));
}}
});
// ]]>
Expand Down
8 changes: 8 additions & 0 deletions jquery.dateFormat-1.0.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,14 @@
retValue += hour;
pattern = "";
break;
case "h":
if (format.charAt(i + 1) == "h") {
break;
}
var hour = (time.hour == 0 ? 12 : time.hour < 13 ? time.hour : time.hour - 12);
retValue += hour;
pattern = "";
break;
case "mm":
retValue += time.minute;
pattern = "";
Expand Down

0 comments on commit a566126

Please sign in to comment.