In this article I will show (and reference) a neat piece of formatting code I found to change a year of 2020 from 2,020 to 2020 in a list view
The Problem
Simply put, if you have a number in a list in SharePoint it will add number formatting by default. A view with a Year number value of 2020 will display as 2,020
The solution
Using Colulumn formatting you can superceed the default formatting by replacing the value displayed in the field with a text value of the same thing
I found the solution on stackexchange – https://sharepoint.stackexchange.com/a/269817/48559
Select the option to format the column
Add the following into the formatting box (advanced mode)
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"attributes": {
"class": "=if(@currentField > 0,'', '')"
},
"children": [
{
"elmType": "span",
"style": {
"display": "inline-block"
}
},
{
"elmType": "span",
"txtContent": "@currentField"
}
]
}