# Limiting calendar date selection

**URL:** <https://forum.inductiveautomation.com/t/limiting-calendar-date-selection/109201>\
**Category:** Ignition\
**Tags:** perspective, vision\
**Created:** [July 31, 2025, 1:26pm UTC](https://forum.inductiveautomation.com/t/limiting-calendar-date-selection/109201 "2025-07-31T13:26:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [July 31, 2025, 1:26pm UTC](https://forum.inductiveautomation.com/t/limiting-calendar-date-selection/109201/1 "2025-07-31T13:26:56Z")

</div>

Vision 8.1.38

I've tried various search strings, and haven't been sucessful finding an answer. Perspective seems to have the feature on its calendar component but not vision?

I have start and end calendars for alarm journal history viewing. I don't want to allow an obscene span of date on the query. Ideally, start and end dates can be selected independently, but if one is 7 days +/- from the other, then limit the date.

I could do this with expression case/if on the journal start/end date itself, but then the calendar presentation would be out of synch with the actual data being queried.

Tldr: is there a way to limit the date selected in a calendar component?

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [July 31, 2025, 1:52pm UTC](https://forum.inductiveautomation.com/t/limiting-calendar-date-selection/109201/2 "2025-07-31T13:52:05Z")

</div>

You could do this on the query side, or with a change script on the component to force the date forward/back to the max.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [July 31, 2025, 1:53pm UTC](https://forum.inductiveautomation.com/t/limiting-calendar-date-selection/109201/3 "2025-07-31T13:53:52Z")

</div>

You could add a `propertyChange` script to clamp the selected date to a max and min value.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/8/38cee9ef6135cfb918284ddf886d8abbc2f14c2f.png)

```python
if event.propertyName == 'date':
	if system.date.isBefore(event.newValue, event.source.minDate):
		event.source.date = event.source.minDate
	elif system.date.isAfter(event.newValue, event.source.maxDate):
		event.source.date = event.source.maxDate

```

---

<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:** [July 31, 2025, 2:03pm UTC](https://forum.inductiveautomation.com/t/limiting-calendar-date-selection/109201/4 "2025-07-31T14:03:35Z")

</div>

> [@robertm](#):
>
> I don't want to allow an obscene span of date on the query

I would use a property change script to enforce this by examining the delta between a new value and the other endpoint, and clipping the other endpoint if the span is too large.

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [July 31, 2025, 2:20pm UTC](https://forum.inductiveautomation.com/t/limiting-calendar-date-selection/109201/5 "2025-07-31T14:20:53Z")

</div>

Of course...not sure why I didnt think of that!

---

<div class="post-metadata">

**Author:** ![robertm](https://avatars.discourse-cdn.com/v4/letter/r/ea5d25/32.png) [@robertm](https://forum.inductiveautomation.com/u/robertm)\
**Post date:** [July 31, 2025, 4:14pm UTC](https://forum.inductiveautomation.com/t/limiting-calendar-date-selection/109201/6 "2025-07-31T16:14:11Z")

</div>

That worked well...I ended up using property change event to alter the opposing calander date to stay within range.

I am now trying to set default sort on the journal. I found this thread, but dont understand @MMaynard suggestion of where to put the script. I do not see any custom filter event or alarm summary control on a journal. Is that referencing an alarm status table instead?

> [@Alarm Journal Sort By Event Time DESC](https://forum.inductiveautomation.com/t/alarm-journal-sort-by-event-time-desc/15278):
>
> To anyone who can tell me how I can have the Alarm Journal Component sort DESC on Event Time by default, I will buy you multiple beers at ICC next week slight_smile
