Commit 9d6ff10b authored by Luc Didry's avatar Luc Didry Committed by Benjamin Bouvier
Browse files

πŸ› β€” Fix timezone mess

I had one operation which date was at midnight, but with a +0200
timezone. The looking for similar operations was made with this date but
in GMT time, two hours before, so Kresus was looking in the previous
day. The result was that the last operation was always duplicated, each
day I had to merge it.

With this commit, I remove the change of timezone in the dates used for
looking for similar operations.
parent 02e09602
Pipeline #421476 passed with stage
in 5 minutes and 33 seconds
......@@ -196,8 +196,12 @@ export default class Transaction {
// TypeORM inserts datetime as "yyyy-mm-dd hh:mm:ss" but SELECT queries use ISO format
// by default so we need to modify the format.
// See https://github.com/typeorm/typeorm/issues/2694
const lowDate = minDate.toISOString().replace(/T.*$/, ' 00:00:00.000');
const highDate = maxDate.toISOString().replace(/T.*$/, ' 23:59:59.999');
const lowDate = `${minDate.getFullYear()}-${(minDate.getMonth() + 1)
.toString()
.padStart(2, '0')}-${minDate.getDate().toString().padStart(2, '0')} 00:00:00.000`;
const highDate = `${maxDate.getFullYear()}-${(maxDate.getMonth() + 1)
.toString()
.padStart(2, '0')}-${maxDate.getDate().toString().padStart(2, '0')} 23:59:59.999`;
return await Transaction.repo().find({
where: {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment