# Get coerced into date error when trying to get a the vlaue from datetimeinput component

**URL:** <https://forum.inductiveautomation.com/t/get-coerced-into-date-error-when-trying-to-get-a-the-vlaue-from-datetimeinput-component/23807>\
**Category:** Ignition Early Access\
**Created:** [April 2, 2019, 11:56pm UTC](https://forum.inductiveautomation.com/t/get-coerced-into-date-error-when-trying-to-get-a-the-vlaue-from-datetimeinput-component/23807 "2019-04-02T23:56:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![john.schlottke](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@john.schlottke](https://forum.inductiveautomation.com/u/john.schlottke)\
**Post date:** [April 2, 2019, 11:56pm UTC](https://forum.inductiveautomation.com/t/get-coerced-into-date-error-when-trying-to-get-a-the-vlaue-from-datetimeinput-component/23807/1 "2019-04-02T23:56:01Z")

</div>

startDate = self.getSibling(‘StartDate’).props.formattedValues.date  
endDate = self.getSibling(‘EndDate’).props.formattedValues.date  
newdate = system.date.addDays(startDate,5)

---

<div class="post-metadata">

**Author:** ![osolorzano](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/osolorzano/32/6432_2.png) [@osolorzano](https://forum.inductiveautomation.com/u/osolorzano)\
**Post date:** [April 3, 2019, 12:14am UTC](https://forum.inductiveautomation.com/t/get-coerced-into-date-error-when-trying-to-get-a-the-vlaue-from-datetimeinput-component/23807/2 "2019-04-03T00:14:13Z")

</div>

props.formattedValues.date is of type string while system.date.addDays() expects a date as the first argument. You will have to parse it into a date before trying to use it, assuming you are using the default format from the datetime input it would look like this:

```auto
newDate = system.date.addDays(system.date.parse(startDate,'MMM d, YYYY'),5)

```

If you’ve changed the format on props.formattedValues.date, then just make sure the second argument in system.date.parse() is the correct format for what is being returned from that property.

---

<div class="post-metadata">

**Author:** ![silverbacknet](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/silverbacknet/32/7385_2.png) [@silverbacknet](https://forum.inductiveautomation.com/u/silverbacknet)\
**Post date:** [April 3, 2019, 12:23am UTC](https://forum.inductiveautomation.com/t/get-coerced-into-date-error-when-trying-to-get-a-the-vlaue-from-datetimeinput-component/23807/3 "2019-04-03T00:23:12Z")

</div>

It would be more robust to use:

```auto
startDate = system.date.fromMillis(self.getSibling('StartDate').props.value)
endDate = system.date.fromMillis(self.getSibling('EndDate').props.value)

```

Now you can directly manipulate them with system.date functions. You can also set props.value = system.date.toMillis(startDate) to change the date, if desired.
