Forum Discussion
JSON Sharepoint Date Validation
- Jan 06, 2021
Can you please add more details about your requirement & conditions to check?
Do you want to show the column value as "Active" when current (today's) date is in between Start date and End Date? Or if both the Start date and End date are in current month?
Please click Mark as Best Response 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.
ganeshsanap your are the best ![]()
Thanks for your help, anyway do you know how to give color (example, active will be green, non active will be red).
Use below code for changing colors:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if(@now >= [$StartDate] && @now <= [$EndDate], 'Active', 'Non Active')",
"style": {
"color": "=if(@now >= [$StartDate] && @now <= [$EndDate], 'green', 'red')",
"font-weight": "bold"
}
}
For more information related to styling refer: Use column formatting to customize SharePoint
If my posts was useful to you, please consider giving it Likes.
- lucasignatiusJan 07, 2021Copper Contributor