Forum Discussion
Lel_999987
Sep 07, 2023Copper Contributor
Get current date in SharePoint
Hi all, how do I get current date which is updated dynamically when a new day starts? E.g I have a date column and a status column. I want to set the status to "not due", "overdue" or "due" de...
pjallex
Oct 01, 2024Copper Contributor
Hi NikolinoDE, I've been trying to alter the JavaScript code with no success 🙂
I need today to be 'Due Soon' and today +1 and today +2 to also be 'Due Soon'. I also need today +3 and more to be 'Not Due'. Can you please show me how this JavaScript code will look like?
Thank you.
pjallex
Oct 02, 2024Copper Contributor
An update., The script is supposed to give "If the "Due Date" is within the next 3 days, it sets the text to "Due Soon" and the color to orange. Otherwise, it sets the text to "Not Due" and the color to green."
In my Sharepoint list everything from today and in the furture is set to Not Due in green. It doesn't distinct that today + 2 days should be Due Soon and orange.
So does something need to be changed in the script or in my Sharepoint settings?
In my Sharepoint list everything from today and in the furture is set to Not Due in green. It doesn't distinct that today + 2 days should be Due Soon and orange.
So does something need to be changed in the script or in my Sharepoint settings?
- pjallexOct 02, 2024Copper ContributorCorrection #2. Everything from tomorrow is set to Not Due in green. Today and all days before today is set to Overdue in red.
- Rob_ElliottOct 03, 2024Silver Contributor
pjallex this all needs to be done with JSON in your column formatting. JSON stands for Javascript Object Notation. Just calling it Javascript as an earlier poster did is not correct, but then I suspect the answer was looked up on ChatGPT.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)- pjallexOct 04, 2024Copper ContributorThx for helping claryfing JSON vs Javascript. Now I know what JSON is short for 🙂
Well... ChatGPT is for me as CD's was for my mum 😂 I haven't tried it for this, but I will give it a go 😀