# \[BUG\] DateArithmetic error

**URL:** <https://forum.inductiveautomation.com/t/bug-datearithmetic-error/21822>\
**Category:** Ignition Early Access\
**Created:** [January 11, 2019, 2:52pm UTC](https://forum.inductiveautomation.com/t/bug-datearithmetic-error/21822 "2019-01-11T14:52:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![scicco](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@scicco](https://forum.inductiveautomation.com/u/scicco)\
**Post date:** [January 11, 2019, 2:52pm UTC](https://forum.inductiveautomation.com/t/bug-datearithmetic-error/21822/1 "2019-01-11T14:52:39Z")

</div>

I imported a 7.9.10 project into 8 and am getting an error on an expression that previously worked:

`dateArithmetic({[.]Current_Shift_Start}, {[.]Site Shift Data/Shift_Time/Shift_Seconds_Total} - 1, “sec”)`

It doesn’t seem to like the tag in the subtraction:

_‘dateArithmetic’ function expected a ‘numeric’ second argument, but got a class java.lang.Object_

Wrapping another dateArithmetic around it does work but I hope I don’t have to do this:

`dateArithmetic(dateArithmetic({[.]Current_Shift_Start}, {[.]Site Shift Data/Shift_Time/Shift_Seconds_Total}, “sec”), -1, “sec”)`

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 11, 2019, 4:24pm UTC](https://forum.inductiveautomation.com/t/bug-datearithmetic-error/21822/2 "2019-01-11T16:24:56Z")

</div>

`dateArithmetic({[.]Current_Shift_Start}, toInt({[.]Site Shift Data/Shift_Time/Shift_Seconds_Total} - 1), “sec”)`

Adding `toInt` should work for now, but this is actually something we’re planning to improve - basically, the notion of expressions requiring static datatypes is going away, so they’ll simply attempt to coerce whenever possible. No exact ETA, but should be in soon.

---

<div class="post-metadata">

**Author:** ![scicco](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@scicco](https://forum.inductiveautomation.com/u/scicco)\
**Post date:** [January 11, 2019, 4:46pm UTC](https://forum.inductiveautomation.com/t/bug-datearithmetic-error/21822/3 "2019-01-11T16:46:26Z")

</div>

Cool - thanks. I had tried the toInt but only around the tag reference. Your workaround is good for now.
