Skip to content

Commit

Permalink
fix: Return normalized years-months-durations
Browse files Browse the repository at this point in the history
A years-months-duration should return a normalized string format. Period.getYear returns the year-component but works only if the period is normalized.
  • Loading branch information
saig0 committed Jan 17, 2025
1 parent bb287f0 commit d87a543
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/org/camunda/feel/syntaxtree/Val.scala
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ case class ValYearMonthDuration(value: YearMonthDuration) extends Val {
object ValYearMonthDuration {

def format(value: YearMonthDuration): String = {
val year = value.getYears
val month = value.getMonths % 12
val year = value.toTotalMonths / 12
val month = value.toTotalMonths % 12

if (year == 0 && month == 0)
"P0Y"
Expand Down

0 comments on commit d87a543

Please sign in to comment.