mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 07:20:12 +01:00
Replaced moment.js with Javascript date.
Thanks to xet7 !
This commit is contained in:
parent
8c5b43295d
commit
cb6afe67a7
18 changed files with 933 additions and 222 deletions
|
|
@ -1,5 +1,24 @@
|
|||
import { ReactiveCache, ReactiveMiniMongoIndex } from '/imports/reactiveCache';
|
||||
import moment from 'moment/min/moment-with-locales';
|
||||
import {
|
||||
formatDateTime,
|
||||
formatDate,
|
||||
formatTime,
|
||||
getISOWeek,
|
||||
isValidDate,
|
||||
isBefore,
|
||||
isAfter,
|
||||
isSame,
|
||||
add,
|
||||
subtract,
|
||||
startOf,
|
||||
endOf,
|
||||
format,
|
||||
parseDate,
|
||||
now,
|
||||
createDate,
|
||||
fromNow,
|
||||
calendar
|
||||
} from '/imports/lib/dateUtils';
|
||||
import {
|
||||
ALLOWED_COLORS,
|
||||
TYPE_CARD,
|
||||
|
|
@ -1492,8 +1511,8 @@ Cards.helpers({
|
|||
expiredVote() {
|
||||
let end = this.getVoteEnd();
|
||||
if (end) {
|
||||
end = moment(end);
|
||||
return end.isBefore(new Date());
|
||||
end = new Date(end);
|
||||
return isBefore(end, new Date());
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
|
@ -1586,8 +1605,8 @@ Cards.helpers({
|
|||
expiredPoker() {
|
||||
let end = this.getPokerEnd();
|
||||
if (end) {
|
||||
end = moment(end);
|
||||
return end.isBefore(new Date());
|
||||
end = new Date(end);
|
||||
return isBefore(end, new Date());
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
|
@ -3201,9 +3220,7 @@ if (Meteor.isServer) {
|
|||
// change list modifiedAt, when user modified the key values in
|
||||
// timingaction array, if it's endAt, put the modifiedAt of list
|
||||
// back to one year ago for sorting purpose
|
||||
const modifiedAt = moment()
|
||||
.subtract(1, 'year')
|
||||
.toISOString();
|
||||
const modifiedAt = add(now(), -1, 'year').toISOString();
|
||||
const boardId = list.boardId;
|
||||
Lists.direct.update(
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,26 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import moment from 'moment/min/moment-with-locales';
|
||||
const Papa = require('papaparse');
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import {
|
||||
formatDateTime,
|
||||
formatDate,
|
||||
formatTime,
|
||||
getISOWeek,
|
||||
isValidDate,
|
||||
isBefore,
|
||||
isAfter,
|
||||
isSame,
|
||||
add,
|
||||
subtract,
|
||||
startOf,
|
||||
endOf,
|
||||
format,
|
||||
parseDate,
|
||||
now,
|
||||
createDate,
|
||||
fromNow,
|
||||
calendar
|
||||
} from '/imports/lib/dateUtils';
|
||||
|
||||
//const stringify = require('csv-stringify');
|
||||
|
||||
|
|
@ -302,15 +321,15 @@ export class Exporter {
|
|||
labels = `${labels + label.name}-${label.color} `;
|
||||
});
|
||||
currentRow.push(labels.trim());
|
||||
currentRow.push(card.startAt ? moment(card.startAt).format() : ' ');
|
||||
currentRow.push(card.dueAt ? moment(card.dueAt).format() : ' ');
|
||||
currentRow.push(card.endAt ? moment(card.endAt).format() : ' ');
|
||||
currentRow.push(card.startAt ? new Date(card.startAt).toISOString() : ' ');
|
||||
currentRow.push(card.dueAt ? new Date(card.dueAt).toISOString() : ' ');
|
||||
currentRow.push(card.endAt ? new Date(card.endAt).toISOString() : ' ');
|
||||
currentRow.push(card.isOvertime ? 'true' : 'false');
|
||||
currentRow.push(card.spentTime);
|
||||
currentRow.push(card.createdAt ? moment(card.createdAt).format() : ' ');
|
||||
currentRow.push(card.modifiedAt ? moment(card.modifiedAt).format() : ' ');
|
||||
currentRow.push(card.createdAt ? new Date(card.createdAt).toISOString() : ' ');
|
||||
currentRow.push(card.modifiedAt ? new Date(card.modifiedAt).toISOString() : ' ');
|
||||
currentRow.push(
|
||||
card.dateLastActivity ? moment(card.dateLastActivity).format() : ' ',
|
||||
card.dateLastActivity ? new Date(card.dateLastActivity).toISOString() : ' ',
|
||||
);
|
||||
if (card.vote && card.vote.question !== '') {
|
||||
let positiveVoters = '';
|
||||
|
|
@ -343,7 +362,7 @@ export class Exporter {
|
|||
if (field.value !== null) {
|
||||
if (customFieldMap[field._id].type === 'date') {
|
||||
customFieldValuesToPush[customFieldMap[field._id].position] =
|
||||
moment(field.value).format();
|
||||
new Date(field.value).toISOString();
|
||||
} else if (customFieldMap[field._id].type === 'dropdown') {
|
||||
const dropdownOptions = result.customFields.find(
|
||||
({ _id }) => _id === field._id,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,26 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
// exporter maybe is broken since Gridfs introduced, add fs and path
|
||||
import { createWorkbook } from './createWorkbook';
|
||||
import {
|
||||
formatDateTime,
|
||||
formatDate,
|
||||
formatTime,
|
||||
getISOWeek,
|
||||
isValidDate,
|
||||
isBefore,
|
||||
isAfter,
|
||||
isSame,
|
||||
add,
|
||||
subtract,
|
||||
startOf,
|
||||
endOf,
|
||||
format,
|
||||
parseDate,
|
||||
now,
|
||||
createDate,
|
||||
fromNow,
|
||||
calendar
|
||||
} from '/imports/lib/dateUtils';
|
||||
|
||||
class ExporterCardPDF {
|
||||
constructor(boardId) {
|
||||
|
|
@ -353,8 +373,8 @@ class ExporterCardPDF {
|
|||
//add data +8 hours
|
||||
function addTZhours(jdate) {
|
||||
const curdate = new Date(jdate);
|
||||
const checkCorrectDate = moment(curdate);
|
||||
if (checkCorrectDate.isValid()) {
|
||||
const checkCorrectDate = new Date(curdate);
|
||||
if (isValidDate(checkCorrectDate)) {
|
||||
return curdate;
|
||||
} else {
|
||||
return ' ';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,26 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import moment from 'moment/min/moment-with-locales';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import { createWorkbook } from './createWorkbook';
|
||||
import {
|
||||
formatDateTime,
|
||||
formatDate,
|
||||
formatTime,
|
||||
getISOWeek,
|
||||
isValidDate,
|
||||
isBefore,
|
||||
isAfter,
|
||||
isSame,
|
||||
add,
|
||||
subtract,
|
||||
startOf,
|
||||
endOf,
|
||||
format,
|
||||
parseDate,
|
||||
now,
|
||||
createDate,
|
||||
fromNow,
|
||||
calendar
|
||||
} from '/imports/lib/dateUtils';
|
||||
|
||||
// exporter maybe is broken since Gridfs introduced, add fs and path
|
||||
|
||||
|
|
@ -379,8 +398,8 @@ class ExporterExcel {
|
|||
function addTZhours(jdate) {
|
||||
if (!jdate) { return ' '; }
|
||||
const curdate = new Date(jdate);
|
||||
const checkCorrectDate = moment(curdate);
|
||||
if (checkCorrectDate.isValid()) {
|
||||
const checkCorrectDate = new Date(curdate);
|
||||
if (isValidDate(checkCorrectDate)) {
|
||||
return curdate;
|
||||
} else {
|
||||
return ' ';
|
||||
|
|
|
|||
|
|
@ -1,10 +1,29 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import moment from 'moment/min/moment-with-locales';
|
||||
import { TAPi18n } from '/imports/i18n';
|
||||
import {
|
||||
formatDateTime,
|
||||
formatDate,
|
||||
formatTime,
|
||||
getISOWeek,
|
||||
isValidDate,
|
||||
isBefore,
|
||||
isAfter,
|
||||
isSame,
|
||||
add,
|
||||
subtract,
|
||||
startOf,
|
||||
endOf,
|
||||
format,
|
||||
parseDate,
|
||||
now,
|
||||
createDate,
|
||||
fromNow,
|
||||
calendar
|
||||
} from '/imports/lib/dateUtils';
|
||||
|
||||
const DateString = Match.Where(function(dateAsString) {
|
||||
check(dateAsString, String);
|
||||
return moment(dateAsString, moment.ISO_8601).isValid();
|
||||
return isValidDate(new Date(dateAsString));
|
||||
});
|
||||
|
||||
export class TrelloCreator {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,28 @@
|
|||
import { ReactiveCache } from '/imports/reactiveCache';
|
||||
import moment from 'moment/min/moment-with-locales';
|
||||
import {
|
||||
formatDateTime,
|
||||
formatDate,
|
||||
formatTime,
|
||||
getISOWeek,
|
||||
isValidDate,
|
||||
isBefore,
|
||||
isAfter,
|
||||
isSame,
|
||||
add,
|
||||
subtract,
|
||||
startOf,
|
||||
endOf,
|
||||
format,
|
||||
parseDate,
|
||||
now,
|
||||
createDate,
|
||||
fromNow,
|
||||
calendar
|
||||
} from '/imports/lib/dateUtils';
|
||||
|
||||
const DateString = Match.Where(function(dateAsString) {
|
||||
check(dateAsString, String);
|
||||
return moment(dateAsString, moment.ISO_8601).isValid();
|
||||
return isValidDate(new Date(dateAsString));
|
||||
});
|
||||
|
||||
export class WekanCreator {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue