diff options
Diffstat (limited to 'plugins/CoreHome/angularjs/common/services/periods.js')
-rw-r--r-- | plugins/CoreHome/angularjs/common/services/periods.js | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/plugins/CoreHome/angularjs/common/services/periods.js b/plugins/CoreHome/angularjs/common/services/periods.js index 3bc9861e79..6f2deadf73 100644 --- a/plugins/CoreHome/angularjs/common/services/periods.js +++ b/plugins/CoreHome/angularjs/common/services/periods.js @@ -59,7 +59,7 @@ DayPeriod.prototype = { getPrettyString: function () { - return $.datepicker.formatDate('yy-mm-dd', this.dateInPeriod); + return format(this.dateInPeriod); }, getDateRange: function () { @@ -83,8 +83,8 @@ WeekPeriod.prototype = { getPrettyString: function () { var weekDates = this.getDateRange(this.dateInPeriod); - var startWeek = $.datepicker.formatDate('yy-mm-dd', weekDates[0]); - var endWeek = $.datepicker.formatDate('yy-mm-dd', weekDates[1]); + var startWeek = format(weekDates[0]); + var endWeek = format(weekDates[1]); return _pk_translate('General_DateRangeFromTo', [startWeek, endWeek]); }, @@ -252,8 +252,8 @@ RangePeriod.prototype = { getPrettyString: function () { - var start = $.datepicker.formatDate('yy-mm-dd', this.startDate); - var end = $.datepicker.formatDate('yy-mm-dd', this.endDate); + var start = format(this.startDate); + var end = format(this.endDate); return _pk_translate('General_DateRangeFromTo', [start, end]); }, @@ -271,7 +271,9 @@ isRecognizedPeriod: isRecognizedPeriod, get: get, parse: parse, - parseDate: parseDate + parseDate: parseDate, + format: format, + RangePeriod: RangePeriod }; function getAllLabels() { @@ -310,6 +312,10 @@ }; } + function format(date) { + return $.datepicker.formatDate('yy-mm-dd', date); + } + function parseDate(strDate) { if (strDate instanceof Date) { return strDate; |