From 4e6bc71f49d532389cf8be3d3bb9b20641a6cd09 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Mon, 21 Oct 2013 08:18:06 -0700 Subject: [PATCH] Added year/y to date math parser --- src/app/components/kbn.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/components/kbn.js b/src/app/components/kbn.js index 37fded1776a..8c8e49d2452 100755 --- a/src/app/components/kbn.js +++ b/src/app/components/kbn.js @@ -316,6 +316,15 @@ function($, _, moment) { } unit = mathString.charAt(i++); switch (unit) { + case 'y': + if (type === 0) { + roundUp ? dateTime.endOf('year') : dateTime.startOf('year'); + } else if (type === 1) { + dateTime.add('years',num); + } else if (type === 2) { + dateTime.subtract('years',num); + } + break; case 'M': if (type === 0) { roundUp ? dateTime.endOf('month') : dateTime.startOf('month');