Commit 438a73c5 by Joona Romppanen

Added moment.js locales. Set locale from window.navigator at app init(). Use…

Added moment.js locales. Set locale from window.navigator at app init(). Use firstDayOfWeek on time picker
parent 07e522bb
......@@ -14,6 +14,7 @@ import $ from 'jquery';
import angular from 'angular';
import config from 'app/core/config';
import _ from 'lodash';
import moment from 'moment';
import {coreModule} from './core/core';
export class GrafanaApp {
......@@ -47,6 +48,8 @@ export class GrafanaApp {
}
$httpProvider.useApplyAsync(true);
moment.locale(window.navigator.userLanguage || window.navigator.language);
this.registerFunctions.controller = $controllerProvider.register;
this.registerFunctions.directive = $compileProvider.directive;
this.registerFunctions.factory = $provide.factory;
......
......@@ -15,7 +15,7 @@
</div>
<div ng-if="openFromPicker">
<datepicker ng-model="ctrl.absolute.fromJs" class="gf-timepicker-component" show-weeks="false" ng-change="ctrl.absoluteFromChanged()"></datepicker>
<datepicker ng-model="ctrl.absolute.fromJs" class="gf-timepicker-component" show-weeks="false" starting-day="firstDayOfWeek" ng-change="ctrl.absoluteFromChanged()"></datepicker>
</div>
......@@ -32,7 +32,7 @@
</div>
<div ng-if="openToPicker">
<datepicker ng-model="ctrl.absolute.toJs" class="gf-timepicker-component" show-weeks="false" ng-change="ctrl.absoluteToChanged()"></datepicker>
<datepicker ng-model="ctrl.absolute.toJs" class="gf-timepicker-component" show-weeks="false" starting-day="firstDayOfWeek" ng-change="ctrl.absoluteToChanged()"></datepicker>
</div>
<label class="small">Refreshing every:</label>
......
......@@ -24,6 +24,7 @@ export class TimePickerCtrl {
refresh: any;
isOpen: boolean;
isUtc: boolean;
firstDayOfWeek: number;
/** @ngInject */
constructor(private $scope, private $rootScope, private timeSrv) {
......@@ -43,6 +44,8 @@ export class TimePickerCtrl {
_.defaults(this.panel, TimePickerCtrl.defaults);
this.firstDayOfWeek = moment.localeData().firstDayOfWeek();
var time = angular.copy(this.timeSrv.timeRange());
var timeRaw = angular.copy(this.timeSrv.timeRange(false));
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment