Skip to content

Commit d87a543

Browse files
committed
fix: Return normalized years-months-durations
A years-months-duration should return a normalized string format. Period.getYear returns the year-component but works only if the period is normalized.
1 parent bb287f0 commit d87a543

File tree

1 file changed

+2
-2
lines changed
  • src/main/scala/org/camunda/feel/syntaxtree

1 file changed

+2
-2
lines changed

src/main/scala/org/camunda/feel/syntaxtree/Val.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ case class ValYearMonthDuration(value: YearMonthDuration) extends Val {
219219
object ValYearMonthDuration {
220220

221221
def format(value: YearMonthDuration): String = {
222-
val year = value.getYears
223-
val month = value.getMonths % 12
222+
val year = value.toTotalMonths / 12
223+
val month = value.toTotalMonths % 12
224224

225225
if (year == 0 && month == 0)
226226
"P0Y"

0 commit comments

Comments
 (0)