Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
fix(converter): fix normalize date
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Mar 3, 2019
1 parent 97544eb commit a457f50
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions back/src/money/application/CurrencyConverter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable } from '@nestjs/common'
import { differenceInDays, startOfHour } from 'date-fns'
import { differenceInDays, startOfHour, startOfDay } from 'date-fns'

import { EntitySaver } from '@back/db/EntitySaver'
import { Currency } from '@shared/enum/Currency'
Expand Down Expand Up @@ -28,8 +28,8 @@ export class CurrencyConverter {
return amount
}

const normalizedDate = startOfHour(when)
const normalizedNowDate = startOfHour(new Date())
const normalizedDate = startOfDay(when)
const normalizedNowDate = startOfDay(new Date())

const rate = await this.getExistRate(from, to, normalizedDate)
.catch(() => this.getActualRate(from, to, normalizedDate))
Expand Down

0 comments on commit a457f50

Please sign in to comment.