fix timezone issue

This commit is contained in:
Moriz Wahl 2022-01-20 16:50:13 +01:00
parent 62e8ea3c04
commit 455012147c
3 changed files with 14 additions and 18 deletions

View File

@ -199,11 +199,10 @@ export default {
// eslint-disable-next-line no-console
console.log('SUBMIT CREATION => ' + this.type + ' >> für VIELE ' + i + ' Mitglieder')
this.submitObj = []
const date = new Date(this.radioSelected.date)
this.items.forEach((item) => {
this.submitObj.push({
email: item.email,
creationDate: date.toISOString(),
creationDate: this.radioSelected.date,
amount: Number(this.value),
memo: this.text,
moderator: Number(this.$store.state.moderator.id),
@ -235,15 +234,13 @@ export default {
this.$toasted.error(error.message)
})
} else if (this.type === 'singleCreation') {
const date = new Date(this.radioSelected.date)
this.submitObj = {
email: this.item.email,
creationDate: date.toISOString(),
creationDate: this.radioSelected.date,
amount: Number(this.value),
memo: this.text,
moderator: Number(this.$store.state.moderator.id),
}
this.$apollo
.mutate({
mutation: createPendingCreation,
@ -292,7 +289,7 @@ export default {
short: this.$d(this.now, 'month'),
long: this.$d(this.now, 'short'),
year: this.$d(this.now, 'year'),
date: this.now,
date: this.$d(this.now, 'short', 'en'),
}
},
lastMonth() {
@ -302,7 +299,7 @@ export default {
short: this.$d(lastMonth, 'month'),
long: this.$d(lastMonth, 'short'),
year: this.$d(lastMonth, 'year'),
date: lastMonth,
date: this.$d(lastMonth, 'short', 'en'),
}
},
beforeLastMonth() {
@ -312,7 +309,7 @@ export default {
short: this.$d(beforeLastMonth, 'month'),
long: this.$d(beforeLastMonth, 'short'),
year: this.$d(beforeLastMonth, 'year'),
date: beforeLastMonth,
date: this.$d(beforeLastMonth, 'short', 'en'),
}
},
},

View File

@ -108,7 +108,7 @@ describe('EditCreationFormular', () => {
expect.objectContaining({
variables: {
amount: 90,
creationDate: '2021-10-31T23:00:00.000Z',
creationDate: '2021-10-31',
email: 'bob@baumeister.de',
id: 0,
memo: 'Test create coins',
@ -180,7 +180,7 @@ describe('EditCreationFormular', () => {
expect.objectContaining({
variables: {
amount: 90,
creationDate: '2021-11-30T23:00:00.000Z',
creationDate: '2021-11-30',
email: 'bob@baumeister.de',
id: 0,
memo: 'Test create coins',
@ -236,7 +236,7 @@ describe('EditCreationFormular', () => {
expect.objectContaining({
variables: {
amount: 90,
creationDate: expect.stringContaining('2022-01-20T'),
creationDate: '2022-01-20',
email: 'bob@baumeister.de',
id: 0,
memo: 'Test create coins',

View File

@ -169,11 +169,10 @@ export default {
this.rangeMax = this.creation[index]
},
submitCreation() {
const date = new Date(this.radioSelected.date)
this.submitObj = {
id: this.item.id,
email: this.item.email,
creationDate: date.toISOString(),
creationDate: this.radioSelected.date,
amount: Number(this.value),
memo: this.text,
moderator: Number(this.$store.state.moderator.id),
@ -222,25 +221,25 @@ export default {
return {
short: this.$d(this.now, 'month'),
long: this.$d(this.now, 'short'),
date: this.now,
date: this.$d(this.now, 'short', 'en'),
}
},
lastMonth() {
const now = new Date(this.now)
const lastMonth = new Date(now.getFullYear(), now.getMonth() - 1, 1)
const lastMonth = new Date(now.getFullYear(), now.getMonth() - 1, 1, 0)
return {
short: this.$d(lastMonth, 'month'),
long: this.$d(lastMonth, 'short'),
date: lastMonth,
date: this.$d(lastMonth, 'short', 'en'),
}
},
beforeLastMonth() {
const now = new Date(this.now)
const beforeLastMonth = new Date(now.getFullYear(), now.getMonth() - 2, 1)
const beforeLastMonth = new Date(now.getFullYear(), now.getMonth() - 2, 1, 0)
return {
short: this.$d(beforeLastMonth, 'month'),
long: this.$d(beforeLastMonth, 'short'),
date: beforeLastMonth,
date: this.$d(beforeLastMonth, 'short', 'en'),
}
},
},