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