Swap moment.js with date-fns
This commit is contained in:
parent
5972476735
commit
f690a6f457
21 changed files with 64 additions and 59 deletions
|
@ -10,8 +10,8 @@
|
|||
"dependencies": {
|
||||
"bulma": "^0.8.0",
|
||||
"copy-to-clipboard": "^3.2.0",
|
||||
"date-fns": "^2.10.0",
|
||||
"lodash": "^4.17.15",
|
||||
"moment": "^2.24.0",
|
||||
"register-service-worker": "^1.6.2",
|
||||
"v-tooltip": "^2.0.2",
|
||||
"verte": "^0.0.12",
|
||||
|
|
|
@ -132,12 +132,12 @@ Vue.directive('focus', {
|
|||
auth.checkAuth()
|
||||
|
||||
// Mixins
|
||||
import moment from 'moment'
|
||||
import message from './message'
|
||||
import {format, formatDistance} from 'date-fns'
|
||||
Vue.mixin({
|
||||
methods: {
|
||||
formatDateSince: date => moment(date).fromNow(),
|
||||
formatDate: date => moment(date).format('LLL'),
|
||||
formatDateSince: date => formatDistance(date, new Date()),
|
||||
formatDate: date => format(date, 'PPPPpppp'),
|
||||
error: (e, context, actions = []) => message.error(e, context, actions),
|
||||
success: (s, context, actions = []) => message.success(s, context, actions),
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import AttachmentModel from '../models/attachment'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class AttachmentService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -12,7 +12,7 @@ export default class AttachmentService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import LabelModel from '../models/label'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class LabelService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -14,8 +14,8 @@ export default class LabelService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import LinkShareModel from '../models/linkShare'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class ListService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -13,8 +13,8 @@ export default class ListService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import AbstractService from './abstractService'
|
||||
import ListModel from '../models/list'
|
||||
import TaskService from './task'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class ListService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -14,8 +14,8 @@ export default class ListService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import UserModel from '../models/user'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class ListUserService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -10,8 +10,8 @@ export default class ListUserService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import NamespaceModel from '../models/namespace'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class NamespaceService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -14,8 +14,8 @@ export default class NamespaceService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import AbstractService from './abstractService'
|
||||
import TaskModel from '../models/task'
|
||||
import AttachmentService from './attachment'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class TaskService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -31,11 +31,11 @@ export default class TaskService extends AbstractService {
|
|||
model.listID = Number(model.listID)
|
||||
|
||||
// Convert dates into an iso string
|
||||
model.dueDate = moment(model.dueDate).toISOString()
|
||||
model.startDate = moment(model.startDate).toISOString()
|
||||
model.endDate = moment(model.endDate).toISOString()
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.dueDate = model.dueDate === null ? null : formatISO(model.dueDate)
|
||||
model.startDate = model.startDate === null ? null : formatISO(model.startDate)
|
||||
model.endDate = model.endDate === null ? null : formatISO(model.endDate)
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
|
||||
// remove all nulls, these would create empty reminders
|
||||
for (const index in model.reminderDates) {
|
||||
|
@ -47,7 +47,7 @@ export default class TaskService extends AbstractService {
|
|||
// Make normal timestamps from js dates
|
||||
if(model.reminderDates.length > 0) {
|
||||
model.reminderDates = model.reminderDates.map(r => {
|
||||
return moment(r).toISOString()
|
||||
return formatISO(r)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import TaskAssigneeModel from '../models/taskAssignee'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class TaskAssigneeService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -11,7 +11,7 @@ export default class TaskAssigneeService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import TaskModel from '../models/task'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class TaskCollectionService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -10,8 +10,8 @@ export default class TaskCollectionService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import TaskCommentModel from '../models/taskComment'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class TaskCommentService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -14,8 +14,8 @@ export default class TaskCommentService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import TaskRelationModel from '../models/taskRelation'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class TaskRelationService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -11,7 +11,7 @@ export default class TaskRelationService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import TeamModel from '../models/team'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class TeamService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -14,8 +14,8 @@ export default class TeamService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import AbstractService from './abstractService'
|
||||
import TeamListModel from '../models/teamList'
|
||||
import TeamModel from '../models/team'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class TeamListService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -14,8 +14,8 @@ export default class TeamListService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import TeamMemberModel from '../models/teamMember'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class TeamMemberService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -11,8 +11,8 @@ export default class TeamMemberService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import AbstractService from './abstractService'
|
||||
import TeamNamespaceModel from '../models/teamNamespace'
|
||||
import TeamModel from '../models/team'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class TeamNamespaceService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -14,8 +14,8 @@ export default class TeamNamespaceService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import AbstractService from './abstractService'
|
||||
import UserModel from '../models/user'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class UserService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -10,8 +10,8 @@ export default class UserService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import AbstractService from './abstractService'
|
||||
import UserListModel from '../models/userList'
|
||||
import UserModel from '../models/user'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class UserListService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -14,8 +14,8 @@ export default class UserListService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import AbstractService from './abstractService'
|
||||
import UserNamespaceModel from '../models/userNamespace'
|
||||
import UserModel from '../models/user'
|
||||
import moment from 'moment'
|
||||
import {formatISO} from 'date-fns'
|
||||
|
||||
export default class UserNamespaceService extends AbstractService {
|
||||
constructor() {
|
||||
|
@ -14,8 +14,8 @@ export default class UserNamespaceService extends AbstractService {
|
|||
}
|
||||
|
||||
processModel(model) {
|
||||
model.created = moment(model.created).toISOString()
|
||||
model.updated = moment(model.updated).toISOString()
|
||||
model.created = formatISO(model.created)
|
||||
model.updated = formatISO(model.updated)
|
||||
return model
|
||||
}
|
||||
|
||||
|
|
|
@ -4851,6 +4851,11 @@ date-fns@^1.27.2:
|
|||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
|
||||
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
|
||||
|
||||
date-fns@^2.10.0:
|
||||
version "2.10.0"
|
||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.10.0.tgz#abd10604d8bafb0bcbd2ba2e9b0563b922ae4b6b"
|
||||
integrity sha512-EhfEKevYGWhWlZbNeplfhIU/+N+x0iCIx7VzKlXma2EdQyznVlZhCptXUY+BegNpPW2kjdx15Rvq503YcXXrcA==
|
||||
|
||||
de-indent@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
|
||||
|
|
Loading…
Reference in a new issue