Fixes #314
This commit is contained in:
@@ -47,7 +47,7 @@ import {
|
|||||||
SyncResolutionMenu
|
SyncResolutionMenu
|
||||||
} from './directives/views';
|
} from './directives/views';
|
||||||
|
|
||||||
import { appDate, appDateTime, trusted } from './filters';
|
import { trusted } from './filters';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActionsManager,
|
ActionsManager,
|
||||||
@@ -136,8 +136,6 @@ angular
|
|||||||
// Filters
|
// Filters
|
||||||
angular
|
angular
|
||||||
.module('app')
|
.module('app')
|
||||||
.filter('appDate', appDate)
|
|
||||||
.filter('appDateTime', appDateTime)
|
|
||||||
.filter('trusted', ['$sce', trusted]);
|
.filter('trusted', ['$sce', trusted]);
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { PrivilegesManager } from '@/services/privilegesManager';
|
import { PrivilegesManager } from '@/services/privilegesManager';
|
||||||
|
import { dateToLocalizedString } from '@/utils';
|
||||||
import template from '%/footer.pug';
|
import template from '%/footer.pug';
|
||||||
import {
|
import {
|
||||||
APP_STATE_EVENT_EDITOR_FOCUSED,
|
APP_STATE_EVENT_EDITOR_FOCUSED,
|
||||||
@@ -268,7 +269,7 @@ class FooterCtrl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
syncUpdated() {
|
syncUpdated() {
|
||||||
this.lastSyncDate = new Date();
|
this.lastSyncDate = dateToLocalizedString(new Date());
|
||||||
}
|
}
|
||||||
|
|
||||||
onNewUpdateAvailable() {
|
onNewUpdateAvailable() {
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
// reuse
|
|
||||||
var locale, formatter;
|
|
||||||
|
|
||||||
/* @ngInject */
|
|
||||||
export function appDate($filter) {
|
|
||||||
return function(input) {
|
|
||||||
return input ? $filter('date')(new Date(input), 'MM/dd/yyyy', 'UTC') : '';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/* @ngInject */
|
|
||||||
export function appDateTime($filter) {
|
|
||||||
return function(input) {
|
|
||||||
if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) {
|
|
||||||
if (!formatter) {
|
|
||||||
locale =
|
|
||||||
navigator.languages && navigator.languages.length
|
|
||||||
? navigator.languages[0]
|
|
||||||
: navigator.language;
|
|
||||||
formatter = new Intl.DateTimeFormat(locale, {
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'numeric',
|
|
||||||
day: '2-digit',
|
|
||||||
hour: '2-digit',
|
|
||||||
minute: '2-digit'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return formatter.format(input);
|
|
||||||
} else {
|
|
||||||
return input ? $filter('date')(new Date(input), 'MM/dd/yyyy h:mm a') : '';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,2 +1 @@
|
|||||||
export { appDate, appDateTime } from './appDate';
|
|
||||||
export { trusted } from './trusted';
|
export { trusted } from './trusted';
|
||||||
|
|||||||
@@ -39,9 +39,35 @@ export function getPlatformString() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let sharedDateFormatter;
|
||||||
|
export function dateToLocalizedString(date) {
|
||||||
|
if (typeof Intl !== 'undefined' && Intl.DateTimeFormat) {
|
||||||
|
if (!sharedDateFormatter) {
|
||||||
|
const locale = (
|
||||||
|
(navigator.languages && navigator.languages.length)
|
||||||
|
? navigator.languages[0]
|
||||||
|
: navigator.language
|
||||||
|
);
|
||||||
|
sharedDateFormatter = new Intl.DateTimeFormat(locale, {
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'numeric',
|
||||||
|
day: '2-digit',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return sharedDateFormatter.format(date);
|
||||||
|
} else {
|
||||||
|
// IE < 11, Safari <= 9.0.
|
||||||
|
// In English, this generates the string most similar to
|
||||||
|
// the toLocaleDateString() result above.
|
||||||
|
return date.toDateString() + ' ' + date.toLocaleTimeString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Via https://davidwalsh.name/javascript-debounce-function */
|
/** Via https://davidwalsh.name/javascript-debounce-function */
|
||||||
export function debounce(func, wait, immediate) {
|
export function debounce(func, wait, immediate) {
|
||||||
var timeout;
|
let timeout;
|
||||||
return function () {
|
return function () {
|
||||||
const context = this;
|
const context = this;
|
||||||
const args = arguments;
|
const args = arguments;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
ng-if='ctrl.lastSyncDate && !ctrl.isRefreshing'
|
ng-if='ctrl.lastSyncDate && !ctrl.isRefreshing'
|
||||||
)
|
)
|
||||||
.sk-label.subtle
|
.sk-label.subtle
|
||||||
| Last refreshed {{ctrl.lastSyncDate | appDateTime}}
|
| Last refreshed {{ctrl.lastSyncDate}}
|
||||||
.sk-app-bar-item(
|
.sk-app-bar-item(
|
||||||
ng-click='ctrl.toggleSyncResolutionMenu()',
|
ng-click='ctrl.toggleSyncResolutionMenu()',
|
||||||
ng-if='(ctrl.outOfSync && !ctrl.isRefreshing) || ctrl.showSyncResolution'
|
ng-if='(ctrl.outOfSync && !ctrl.isRefreshing) || ctrl.showSyncResolution'
|
||||||
|
|||||||
112
dist/javascripts/app.js
vendored
112
dist/javascripts/app.js
vendored
File diff suppressed because one or more lines are too long
2
dist/javascripts/app.js.map
vendored
2
dist/javascripts/app.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user