Skip to content

Commit 243777a

Browse files
authored
Merge pull request #414 from kewne/fix_avoid_weekend
fix: Fallback to friday instead of two days before
2 parents 980334e + eae5ab7 commit 243777a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

moneta-convert/moneta-convert-ecb/src/test/java/org/javamoney/moneta/convert/ecb/ECBHistoricRateProviderTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static org.testng.Assert.*;
2020

2121
import java.math.BigDecimal;
22+
import java.time.DayOfWeek;
2223
import java.time.LocalDate;
2324
import java.time.LocalDateTime;
2425
import java.time.temporal.ChronoField;
@@ -162,7 +163,7 @@ void selectFromECBWithGivenDate() {
162163
LocalDateTime time = LocalDateTime.now();
163164
// As ECB rates are only updated on 4pm of each day, we check, if it's after 4 or the day is on a weekend (cannot get all bank holidays yet)
164165
if (isWeekend(time)) {
165-
time = time.minusDays(2);
166+
time = time.with(DayOfWeek.FRIDAY);
166167
} else {
167168
if (time.getHour() < 16) {
168169
time = time.minusDays(1);

0 commit comments

Comments
 (0)