Permalink
Browse files

Kronic.parse can now be used without strftime (JS)

  • Loading branch information...
1 parent 315ca02 commit 1cb7cbff66570c20bb35e835525197aa6b1996fb @eugenebolshakov eugenebolshakov committed Oct 27, 2010
Showing with 3 additions and 10 deletions.
  1. +3 −10 lib/js/kronic.js
View
@@ -7,15 +7,8 @@ var Kronic = (function() {
var NUMBER_WITH_ORDINAL = /^([0-9]+)(st|nd|rd|th)?$/;
var ISO_8601_DATE = /^([0-9]{4})-?(1[0-2]|0?[1-9])-?(3[0-1]|[1-2][0-9]|0?[1-9])$/;
- var MONTH_NAMES = [];
-
- for (var i = 0; i < 12; i++) {
- var addMonth = function(formatter) {
- MONTH_NAMES.push((new Date(2010, i, 1)).strftime(formatter).toLowerCase());
- };
- addMonth("%b");
- addMonth("%B");
- }
+ var MONTH_NAMES = ["january", "jan", "february", "feb", "march", "mar", "april", "apr", "may", "may", "june", "jun", "july", "jul", "august", "aug", "september", "sep", "october", "oct", "november", "nov", "december", "dec"];
+ var DAY_NAMES = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
function trim(string) {
return string.replace(/^\s+|\s+$/g, '');
@@ -56,7 +49,7 @@ var Kronic = (function() {
});
days = inject(days, {}, function(a, x) {
- a[x.strftime("%A").toLowerCase()] = x;
+ a[DAY_NAMES[x.getDay()]] = x;
return a;
});

0 comments on commit 1cb7cbf

Please sign in to comment.