SOLVED

Date/Time column displays seconds if I apply JSON inlineEditField formatting

Copper Contributor

Hello, 

 

I have two date/time columns. They must continue to display as below: 

FSomers_0-1674785334572.png

Due to OPO internal name is DuetoOPO

Requestor Due date internal name is DueDate

 

We would like to use inlineEditField so users can just click to update due date times.

 

If I apply this JSON: 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "inlineEditField": "[$DuetoOPO]",
  "txtContent": "[$DuetoOPO]"
}

 

SharePoint displays the seconds after the due date.  How can I format so it will only show the date and time with HH:mm after applying the inlineEditField JSON??

FSomers_1-1674785600167.png

 

2 Replies
best response confirmed by FSomers (Copper Contributor)
Solution

@FSomers 

Try the following, which works in my testing. Different countries may have different results.

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "inlineEditField": "@currentField",
  "txtContent": "@currentField"
}

 

If that does not work for you, we can manually build a formatted date/time string.

Good luck!
Don

If my answer helps solve or resolve your issue, please consider clicking Mark as Best Response & Like. 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 a Like.

Don, thank you thank you thank you! I'm very new with JSON and have managed to fumble my way into a bunch of things and sometimes it's the simplest ones that give me trouble. This works perfectly, so appreciate it!!!
1 best response

Accepted Solutions
best response confirmed by FSomers (Copper Contributor)
Solution

@FSomers 

Try the following, which works in my testing. Different countries may have different results.

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "inlineEditField": "@currentField",
  "txtContent": "@currentField"
}

 

If that does not work for you, we can manually build a formatted date/time string.

Good luck!
Don

If my answer helps solve or resolve your issue, please consider clicking Mark as Best Response & Like. 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 a Like.

View solution in original post