Reputation: 1015
I have a scala function:
It return an error, it do not accept the parameters in plusDays and minusDay, knowing that I added all the required import:
<console>:143: error: type mismatch;
found : java.time.LocalDate
required: String
toEnd(rd1.toLocalTime) + jourOuvree(rd1.toLocalDate.plusDays(1), rd2.toLocalDate.minusDays(1)) * 8.hours + toStart(rd2.toLocalTime)
^
<console>:143: error: type mismatch;
found : java.time.LocalDate
required: String
toEnd(rd1.toLocalTime) + jourOuvree(rd1.toLocalDate.plusDays(1), rd2.toLocalDate.minusDays(1)) * 8.hours + toStart(rd2.toLocalTime)
Can you help me please ?
Upvotes: 1
Views: 53
Reputation: 7928
The error is in jourOuvree, not in the parameters in plusDays and minusDay as you say. You should check your method signature.
If your method jourOuvree requires a date in String format as it seems to be the case, you can call a toString
after the plusDays
method
Example:
Without toString:
rd1.toLocalDate.plusDays(1)
res1: java.time.LocalDate = 2018-04-05
With toString:
rd1.toLocalDate.plusDays(1).toString
res2: String = 2018-04-05
In your case:
jourOuvree(rd1.toLocalDate.plusDays(1).toString, rd2.toLocalDate.minusDays(1)).toString)
Upvotes: 2