# DateTime Picker defaulting only the time

**URL:** <https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 14, 2025, 4:12am UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802 "2025-12-14T04:12:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 4:12am UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/1 "2025-12-14T04:12:56Z")

</div>

I’m trying to set only the time in the picker to a default value. Right now, the value stays null until the user selects a date, but the time is defaulted to midnight. 99.99% of the item, users interacting with the component will need to look at any date with the time of 07:00:00. Eliminating the requirement to select the date AND change the time from midnight to 7 am is the goal. I’ve tried some script transforms with no success. To summarize:

Value is null until user selects a date. Once date is selected, default time is 07:00:00.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 4:13am UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/2 "2025-12-14T04:13:36Z")

</div>

- 99.99% of the time

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [December 14, 2025, 2:01pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/3 "2025-12-14T14:01:47Z")

</div>

Have you tried using a change script on the value?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [December 14, 2025, 2:10pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/4 "2025-12-14T14:10:00Z")

</div>

I would bind the datepicker value to:  
`toDate(dateFormat(now(0), 'yyyy-MM-dd 07:00:00'))`

The binding will execute once upon opening.

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 2:13pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/5 "2025-12-14T14:13:58Z")

</div>

Will that not change the value to today’s date, without the user selecting it? I want the value to remain null until the user interacts with the component.

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 2:46pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/6 "2025-12-14T14:46:41Z")

</div>

I need this to be 07:00 AM when the user clicks the selector

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/0/a00179c5e3d874bee2dd120c39b3a8f4c93b65ab.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 14, 2025, 2:54pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/7 "2025-12-14T14:54:58Z")

</div>

Consider using the time span embeddable view from my Tag Report Utility (in the exchange). It breaks out separate time entry fields according to the interval selections the user makes, and presets start time/end time when using day boundaries.

> [@Tag Report Utility](https://forum.inductiveautomation.com/t/tag-report-utility/95299):
>
> New resource just uploaded to the Exchange (pending review). Also available here: [https://www.automation-pros.com/TagReportUtility/](https://www.automation-pros.com/TagReportUtility/) I intend to publish at this link as well as in the Exchange going forward. Announcements will be in this topic. (: Highlights: Provides a Perspective Popup View that provides a user interface to system.tag.query() that entirely replicates the functionality of the Designer's Tag Report Tool. Provides a Perspective Embedded View that provides Time Span selectio…

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 3:19pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/8 "2025-12-14T15:19:13Z")

</div>

This may be the way to go. I’m having a hard time with it not constantly applying the change. It cycled from a selected date of today to the year 2180 in a few seconds

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 14, 2025, 3:20pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/9 "2025-12-14T15:20:44Z")

</div>

Note that the embeddable view's parameters are mostly bidirectional, so the defaults for interval, bounds, and start/end are expected to be supplied by the containing view.

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 3:36pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/10 "2025-12-14T15:36:37Z")

</div>

Got it

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/2/624a79984e4a017f7acf74359719e05a52847008.png)

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 3:40pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/11 "2025-12-14T15:40:17Z")

</div>

Spoke too soon, the user can’t override the change script by selecting a different time.

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [December 14, 2025, 4:32pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/12 "2025-12-14T16:32:25Z")

</div>

What if you check if is None?

> If currentValue.value is None:
> 
> ```python
> Your script here
> 
> ```
> 
> ```python
> 
> ```

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 4:39pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/13 "2025-12-14T16:39:27Z")

</div>

It needs a legit dateTime value to apply the setTime function to. Might need to do this on session start up instead of the components value property change

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 4:40pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/14 "2025-12-14T16:40:43Z")

</div>

This seems way more complex than it should be. There must be some simpler way to have the component start at a time of 07:00 AM instead of 12:00 AM

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 4:52pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/15 "2025-12-14T16:52:08Z")

</div>

Tried with previousValue.value is None:

script here

it gives me an error. I guess it needs to see an actual previous value to execute the script

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [December 14, 2025, 5:20pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/16 "2025-12-14T17:20:29Z")

</div>

I don’t understand the necessity of this. In any case, I tried both scenarios:

- The value is `None`, and on the first date selection the time is initially set to midnight and then changed to 07:00.

```python
	if currentValue.value:
		self.props.value = system.date.setTime(currentValue.value, 7, 0, 0) 

```

The value is `None`, and on the first selection the time is already set to 07:00.

```python
    if currentValue.value and previousValue.value is not None:
        self.props.value = system.date.setTime(currentValue.value, 7, 0, 0) 

```

Here the examples:

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 5:32pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/17 "2025-12-14T17:32:53Z")

</div>

Did you try changing the time from 7 am to something else after selecting the date?

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [December 14, 2025, 5:34pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/18 "2025-12-14T17:34:11Z")

</div>

No I didn’t understand that needs. Sorry, I can’t try at the moment

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 5:40pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/19 "2025-12-14T17:40:00Z")

</div>

Here’s what I’ve been able to do so far:

Created an onstartup even that sets a custom property to 1 when the view loads

created a property change script on the components value that if custom view property equals 1, force the time to 7 am when a date is selected, and then set the custom view property to 0.

The limitation with this, of course, is that any other dates selected after the first one, the time defaults back to 12 am.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/7/478709edaf3cc8a490a59f1a41ec0e4f0868958b.png)

---

<div class="post-metadata">

**Author:** ![Cory\_Lambert](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cory\_Lambert](https://forum.inductiveautomation.com/u/Cory_Lambert)\
**Post date:** [December 14, 2025, 5:42pm UTC](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802/20 "2025-12-14T17:42:34Z")

</div>

forgot to make start and end pickers use unique view properties in their scripts.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/8/a8d112edc4a209aac7c5f23e2c1555b67a3cc79f.png)

[Next page](https://forum.inductiveautomation.com/t/datetime-picker-defaulting-only-the-time/112802.md?page=2)
