Forum Discussion
Countdown to due date in SharePoint 365 list
- Jan 11, 2023
Hi kobi1991 ,
sure. This is SharePoint Json list formatting code that formats a column.
https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting
Got to you SharePoint View, select the header of your "Due Date" column and select "Column Settings->Format this Column"
Copy the Json Code here
You don't have to change the formula, as "@currentField" references to the selected Column.
Best Regards,
Sven
Thank you, Sven! Apologies but I'm completely new at this - could you please explain where in the code I should put my 'due date' column?
Karolina
Hi kobi1991 ,
sure. This is SharePoint Json list formatting code that formats a column.
https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting
Got to you SharePoint View, select the header of your "Due Date" column and select "Column Settings->Format this Column"
Copy the Json Code here
You don't have to change the formula, as "@currentField" references to the selected Column.
Best Regards,
Sven
- kobi1991Jan 11, 2023Copper ContributorThank you so much, Sven! It works, but I'm wondering if there's a way to do it the way the 'Countdown' column corresponds to the 'Due date' column as I would like to have a view of the Due date itself, and when adding a new item the 'Countdown' column would populate itself.
Is it at all possible?
Thank you,
Karolina- SvenSieverdingJan 11, 2023Bronze Contributor
Hi kobi1991
You could create a calculated column "Countdown" of type "Date" with the formula
=[Due Date]
and then apply the formatting there.
Then you have two columns with the same value, but one is displaying the date and the other one is displaying the countdown.
Best Regards,Sven
- faric1311Jun 22, 2023Copper Contributor
Hi SvenSieverding,
I have a question about your json code, i have tried to apply the code into my list but all the dates that have past due displays for example "-29 days", is there any code that could make all the dates that have past due displays "0 days"
Thanks
Best Regards,
Faric
- SvenSieverdingJun 22, 2023Bronze Contributor
Hi faric1311,
in that case you can just wrap it into an if clause.
This displays the remaining days, if the calculated value is larger than 0 and "no days remaining" if that value is below or equal 0.{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "txtContent": "=if(floor((Number(@currentField)-Number(Date((getMonth(@now)+1)+'.'+getDate(@now)+'.'+getYear(@now))))/(60*60*24*1000))>0,floor((Number(@currentField)-Number(Date((getMonth(@now)+1)+'.'+getDate(@now)+'.'+getYear(@now))))/(60*60*24*1000))+' day(s) remaining','no days remaining')" }
Best Regards,
Sven- ChawooAug 15, 2023Copper ContributorHi Sven!
I am having a similar issue getting 2 columns in Microsoft Lists - I was hoping to have column A list a date that I manually type in, and column B present a countdown until that date.
I was having issues modifying the information you provided to match my Lists, would you happen to have any insight?
Kindly,
Chase