From ceab6882167b203cb6513fb3b11ea1ccf06c2f1b Mon Sep 17 00:00:00 2001 From: Mark Abbott Date: Sun, 4 Mar 2012 13:36:44 +0000 Subject: [PATCH] Add functionality to support Week Numbers --- morris.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/morris.js b/morris.js index a5c6f32..8753a5b 100644 --- a/morris.js +++ b/morris.js @@ -319,8 +319,11 @@ m = s.match(/^(\d+) Q(\d)$/); n = s.match(/^(\d+)-(\d+)$/); o = s.match(/^(\d+)-(\d+)-(\d+)$/); + p = s.match(/^(\d+) W(\d)$/); if (m) { return parseInt(m[1], 10) + (parseInt(m[2], 10) * 3 - 1) / 12; + } else if (p) { + return parseInt(p[1], 10) + (parseInt(p[2], 10) - 1) / 53; } else if (n) { return parseInt(n[1], 10) + (parseInt(n[2], 10) - 1) / 12; } else if (o) {