Forum Discussion
JSON Form Header Date Calculation
ianthegeordie1892 What is the exact issue when you say "it still doesn't seem to work"? Can you add the screenshots of list form if possible?
Is it not showing the text correctly or are you getting any error message or anything else?
Are you using correct internal name of the date field as suggested above?
And yes, I have tested this on list form and it works for me. Here is the output:
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- ianthegeordie1892Feb 07, 2024Copper Contributor
ganeshsanap Hi the initial selection of the field works but if I change it to a value beyond 90 days it keeps the same message. Yes i use internal names with all my JSON code etc
- ganeshsanapFeb 07, 2024MVP
ianthegeordie1892 Are you using dd/mm/yyyy format for your dates (site regional settings)?
Can you try using the toLocaleDateString() function instead of Date()?
{ "elmType": "div", "txtContent": "=if(Number([$TargetDateForTrial]) == 0, '', if(toLocaleDateString([$TargetDateForTrial]) <= toLocaleDateString(addDays(@now,90)),'OK','Please select date within 90 days.'))" }
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
- ianthegeordie1892Feb 12, 2024Copper ContributorHi thanks for the help to localstring causes an error as 14/02/2024 becomes 02/14/2024 which is a invalid date