Skip to content

Commit

Permalink
Using bhConstans for the render the Date format
Browse files Browse the repository at this point in the history
  • Loading branch information
lomamech committed May 16, 2017
1 parent 306be3e commit 09a1253
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions client/src/js/components/bhPeriodSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ angular.module('bhima.components')
controller : PeriodSelect
});

PeriodSelect.$inject = ['PeriodService'];
PeriodSelect.$inject = ['PeriodService', 'bhConstants'];

function PeriodSelect(Periods) {
function PeriodSelect(Periods, bhConstants) {
var ctrl = this;
var DEFAULT_PERIOD = 'today';

Expand All @@ -27,6 +27,8 @@ function PeriodSelect(Periods) {
to : new Date()
};

ctrl.dateFormat = bhConstants.dates.format;

ctrl.$onInit = function onInit() {
ctrl.periodKey = ctrl.defaultPeriod || DEFAULT_PERIOD;
ctrl.period = Periods.definition(ctrl.periodKey);
Expand Down
2 changes: 1 addition & 1 deletion client/src/modules/templates/bhPeriodSelect.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</span>

<span ng-if="$ctrl.period.customPeriodStart && $ctrl.period.customPeriodEnd">
({{ $ctrl.period.customPeriodStart | date: 'dd/mm/yyyy' }}) - ({{ $ctrl.period.customPeriodEnd | date: 'dd/mm/yyyy' }})
({{ $ctrl.period.customPeriodStart | date: $ctrl.dateFormat }}) - ({{ $ctrl.period.customPeriodEnd | date: $ctrl.dateFormat }})
</span>
</p>

Expand Down

0 comments on commit 09a1253

Please sign in to comment.