remove v-calendar use v-date-picker

This commit is contained in:
les
2020-10-25 00:34:22 +02:00
parent 743c8729d8
commit 767d7d5ffc
7 changed files with 799 additions and 1876 deletions

View File

@@ -1,5 +1,5 @@
const crypto = require('crypto')
const moment = require('moment-timezone')
// const moment = require('moment-timezone')
const path = require('path')
const config = require('config')
const fs = require('fs')
@@ -8,6 +8,7 @@ const _ = require('lodash')
const helpers = require('../../helpers')
const linkifyHtml = require('linkifyjs/html')
const Sequelize = require('sequelize')
const dayjs = require('dayjs')
const Event = require('../models/event')
const Resource = require('../models/resource')
@@ -217,7 +218,7 @@ const eventController = {
where: {
parentId: null,
is_visible: false,
start_datetime: { [Op.gt]: moment().unix() }
start_datetime: { [Op.gt]: dayjs().unix() }
},
order: [['start_datetime', 'ASC']],
include: [{ model: Tag, required: false }, Place]
@@ -417,19 +418,19 @@ const eventController = {
}
},
async _select ({ start, end, tags, places}) {
async _select ({ start, end, tags, places }) {
debug('_select start: %s, end: %s, tags: %s', dayjs.unix(start), end, tags)
const where = {
// confirmed event only
recurrent: null,
is_visible: true,
start_datetime: { [Op.gt]: start },
end_datetime: { [Op.gt]: start }
}
if (end) {
where['end_datetime'] = { [Op.lt]: end }
where.end_datetime = { [Op.lt]: end }
}
if (places) {
where.placeId = places.split(',')
}
@@ -448,7 +449,7 @@ const eventController = {
order: ['start_datetime', [Tag, 'weigth', 'DESC']],
include: [
{ model: Resource, required: false, attributes: ['id'] },
{ model: Tag, attributes: ['tag'], required: tags ? true : false, ...where_tags, through: { attributes: [] } },
{ model: Tag, attributes: ['tag'], required: !!tags, ...where_tags, through: { attributes: [] } },
{ model: Place, required: false, attributes: ['id', 'name', 'address'] }
]
})
@@ -489,10 +490,10 @@ const eventController = {
}
const recurrent = e.recurrent
const cursor = moment()
const cursor = dayjs()
// let cursor = start.startOf('week')
const start_date = moment.unix(e.start_datetime)
const duration = moment.unix(e.end_datetime).diff(start_date, 's')
const start_date = dayjs.unix(e.start_datetime)
const duration = dayjs.unix(e.end_datetime).diff(start_date, 's')
const frequency = recurrent.frequency
const days = recurrent.days
const type = recurrent.type
@@ -532,7 +533,7 @@ const eventController = {
cursor.date(d)
} else {
cursor.day(d - 1)
if (cursor.isBefore(moment())) {
if (cursor.isBefore(dayjs())) {
cursor.day(d - 1 + 7)
}
}
@@ -547,7 +548,7 @@ const eventController = {
/**
* Create instances of recurrent events
*/
async _createRecurrent (start_datetime = moment().unix()) {
async _createRecurrent (start_datetime = dayjs().unix()) {
// select recurrent events
const events = await Event.findAll({
where: { is_visible: true, recurrent: { [Op.ne]: null } },

View File

@@ -15,7 +15,6 @@ const eventController = require('./api/controller/event')
const announceController = require('./api/controller/announce')
const helpers = require('./helpers')
const { startOfMonth, startOfWeek, getUnixTime } = require('date-fns')
const app = express()
// ignore unimplemented ping url from fediverse