Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confiforms filter syntax - date calculations

Drew T
Contributor
August 30, 2023

I have a confiform that I'm trying to add css rules to some fields. I'm having trouble getting the expression correct to make it work. 

I have 6 date fields:

- initial start (initStartDate)

- initial end date (initEndDate)

- Option 1 Start Date (opt1StartDate)

- Option 1 End Date (opt1EndDate)

- Option 2 Start Date (opt2StartDate)

- Option 2 End Date (opt2EndDate)

I'm trying to achieve three filters for css rules based on the initEndDate field. 

1. if opt1StartDate AND opt2StartDate are empty AND initEndDate is greater than 180 days from Today, then background colour should be green. 

2. if opt1StartDate AND opt2StartDate are empty AND initEndDate is less than 180 days from Today, then background colour should be orange

3. if opt1StartDate AND opt2StartDate are empty AND initEndDate is less than or equal to today then background colour should be red

 

I've tried the following approaches trying both timestamp and number of day values but haven't gotten it right yet.  I believe from the docs that datetime intervals need to be done in milliseconds, but unsure if this is also the case for date values.

opt1StartDate:[empty] AND opt2StartDate:[empty] AND initEndDate.subtract(_today):>180

opt1StartDate:[empty] AND opt2StartDate:[empty] AND initEndDate.subtract(_today):>15552000000

opt1StartDate:[empty] AND opt2StartDate:[empty] AND ([entry.initEndDate]-_today):>180

Appreciate any help to identify the issue.

Thanks

Drew

 

2 answers

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Champion
August 31, 2023

Hi @Drew T 

Try the following

opt1StartDate:[empty] AND opt2StartDate:[empty] AND initEndDate:>[today]+180

or

opt1StartDate:[empty] AND opt2StartDate:[empty] AND initEndDate.substract(15552000000):>[entry._now]

Alex 

Drew T
Contributor
September 4, 2023

Thanks @Alex Medved _ConfiForms_  that did the job!

SKAdmin
Contributor
January 12, 2024

@Alex Medved _ConfiForms_ Any reason why none of these work? every date displays error. 

Due is date field, formatted to yyyy-MM-dd

‘ConfiForms Rules for Field Definition w/ condition !due[empty]

Validation Rule

  • due:>[today]+14
  • due:>([entry._today.add(1209600000)])
  • due:>([today]+14)
  • due:>([entry.due.timestamp] +1209600000)
Alex Medved _ConfiForms_
Community Champion
January 15, 2024

You need to define that in the condition, in addition to what you already have

For example

!due:[empty] AND due:>[today]+14

or

!due:[empty] AND due:>([entry._today.add(1209600000)])

Alex

SKAdmin
Contributor
January 16, 2024

No such luck with either. 

Seems to be a bigger issues, as the value is way off. 

due in the ConfiForms Field Definition’ Macro is a Date field type, since this is linked to the due date in Jira for issue creation.

Tried selecting 2/2/24

  • Value '1706860800000' for 'Due Date' does not match the validation rules (due:>([entry._today.add(1209600000)])) set for this field

Can I just use the validation rule section in the ConfiForms Field Definition, or do I have to add ConfiForms Rules for Field Definition’ Macro as well? 

SKAdmin
Contributor
January 16, 2024

If I try just a condition in ConfiForms Rules for Field Definition and no validations it lets all entries go through, even if i pick tomorrow. 

Alex Medved _ConfiForms_
Community Champion
January 17, 2024

Please open a support ticket with us. I recall there was a regression with a validation in few minor versions just recently. Might be related to this (has been fixed some time ago)

SKAdmin
Contributor
January 17, 2024

Let me upgrade to the newest version and retest, that might be the problem. If not, I'll get a support ticket open. 

0 votes
Drew T
Contributor
August 30, 2023

 @Alex Medved _ConfiForms_ are you able to assist?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events