Closed Maarrk closed 5 months ago
Space script throws a parse error when passing a negative number directly:
Error: Parse error in: addDays(today(), -7)
Demonstrated in the following page:
```space-script silverbullet.registerFunction("addDays", (date, days) => { const plainDate = Temporal.PlainDate.from(date); const offsetDate = plainDate.add(Temporal.Duration.from({ days: Number(days) })); return offsetDate.toString(); }); ``` Works: ```template {{addDays(today(), 7)}} ``` Doesn't work: ```template {{addDays(today(), -7)}} ``` Works: ```template {{addDays(today(), 0-7)}} ``` Works if there is conversion with Number inside function: ```template {{addDays(today(), '-7')}} ```
Heh. Right. Probably didn't add negative numbers to the expression language grammar yet.
Space script throws a parse error when passing a negative number directly:
Demonstrated in the following page: