toLocaleString() produces different results with addition (+) vs subtraction (-) operators

Environment

  • Axure RP 11
  • Variables: LVAR1 = “5,000”, LVAR2 = 1

Issue Description

I’m experiencing unexpected behavior with toLocaleString() when used with different arithmetic operators in expressions.

Test Case 1: Subtraction works correctly

[[ (LVAR1.replace(',','') - (LVAR2*5000)).toLocaleString() ]]

Expected result: 5,000
Actual result: 5,000

Test Case 2: Addition produces date format

[[ (LVAR1.replace(',','') + (LVAR2*5000)).toLocaleString() ]]

Expected result: 10,000
Actual result: 1970. 1. 1. 오전 9:00:10 (Date format)

Test Case 3: Without toLocaleString()

[[ (LVAR1.replace(',','') + (LVAR2*5000)) ]]

Result: 10000 (Calculation works correctly)

Test Case 4: Pure number addition still fails

[[ (5000 + (LVAR2*5000)).toLocaleString() ]]

Expected result: 10,000
Actual result: 1970. 1. 1. 오전 9:00:10 (Date format)

Test Case 5: Literal number works

[[ 10000.toLocaleString() ]]

Result: 10,000

Workaround Found

Using double negation with subtraction operator works:

[[ (LVAR1.replace(',','') - (-(LVAR2*5000))).toLocaleString() ]]

Result: 10,000

Question

Why does toLocaleString() treat the result of addition (+) as a Date object but treats the result of subtraction (-) as a Number? Is this intended behavior or a bug?

The calculation itself works correctly (returns 10000), but applying .toLocaleString() to an addition result converts it to a date format, while subtraction results format correctly as numbers.

[[Math
.floor ((LVAR1.replace(‘,’,‘’) + (LVAR2*5000)).toLocaleString() ]]