1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-07 23:03:00 +03:00

Refactored moment.js out of app

Reduces bundle size by 25%
This commit is contained in:
Dan Brown
2018-04-01 14:10:12 +01:00
parent 736d7118b0
commit 0ade9b5b9b
7 changed files with 22 additions and 29 deletions

View File

@@ -1,6 +1,4 @@
const moment = require('moment');
require('moment/locale/en-gb');
moment.locale('en-gb');
import * as Dates from "../services/dates";
let autoSaveFrequency = 30;
@@ -96,9 +94,8 @@ let methods = {
let url = window.baseUrl(`/ajax/page/${this.pageId}/save-draft`);
window.$http.put(url, data).then(response => {
draftErroring = false;
let updateTime = moment.utc(moment.unix(response.data.timestamp)).toDate();
if (!this.isNewDraft) this.isUpdateDraft = true;
this.draftNotifyChange(response.data.message + moment(updateTime).format('HH:mm'));
this.draftNotifyChange(`${response.data.message } ${Dates.utcTimeStampToLocalTime(response.data.timestamp)}`);
lastSave = Date.now();
}, errorRes => {
if (draftErroring) return;