Forum Discussion
Bhavpreet Bains
Jul 12, 2018Iron Contributor
Column formatting for date column
Hello, I was trying to format Due Date column to show green with check mark if the Status is completed. However, after adding the column formatting code, it switched the date format from DD/MM/Y...
spucelik
Microsoft
Jul 12, 2018Bhavpreet...try using the .toLocalDateString() method in you're formatting as described here.
- Bhavpreet BainsJul 12, 2018Iron ContributorHello Steve,
I am wondering if you can help with another query as well.
I am getting Invalid date while trying to do the following. The current Field is of Due Date which is calculated as Created+14. It returns Date Only format for Data and Time data type.
{
"elmType": "div",
"txtContent": {
"operator": "+",
"operands": [
"@currentField",
"1"
]
}
}
Thank you.- spucelikJul 12, 2018
Microsoft
Bhavpreet...to be clear the @currentField in the snippet below is a calculated field in SharePoint? If so Calculated fields are not supported only:
- Single line of text
- Number
- Choice
- Person or Group
- Yes/No
- Hyperlink
- Picture
- Date/Time
- Lookup
- Title (in Lists)
- Bhavpreet BainsJul 12, 2018Iron ContributorSorry to bug you again.
I thought about it. Since calculated fields aren't supported, I decided to change my approach.
I am now trying to calculate the value using conditional formatting. So, I created a Date/Time column and is using the following code.
However, when I subtract from the date, it works fine. It returns the expected result but addition is still giving me Invalid Date.
{
"elmType": "div",
"txtContent": {
"operator": "+",
"operands": [
"[$Created]",
"1"
]
}
}
- Bhavpreet BainsJul 12, 2018Iron Contributor
Thanks, Steve! It worked this time. I must be doing something wrong when I tried using the same last time.