Working with Dates on Tracker

Hello Everyone,
I need some help with dates on an event program.

I am trying to create a validation on a date field to ensure that only dates entered within a specified period are allowed in that field e.g. ART start date must be between October 1, 2017 and September 30, 2018.

How do I create this using a Program rule?

Thank you for your help

1 Like

Hello Dr. Okoye
Did you ever find a solution for this?

1 Like

Hello Adam,
This was a solution provided by one of the DHIS developers some years ago. For this, we were looking at ART start date between a period e.g. 1 Oct 2021 to 30 Sep 2022.

d2:hasValue( ‘dt_art_st’ ) && !(d2:daysBetween(V{current_date}, ‘2021-10-01’) <= d2:daysBetween(V{current_date}, #{dt_art_st}) && d2:daysBetween(V{current_date}, ‘2022-09-30’) >= d2:daysBetween(V{current_date}, #{dt_art_st}))

Let me know if this works for you

2 Likes