Forum Discussion
Sharepoint list creation from Excel breaks my dates
- Feb 08, 2021
This fixes the output but really ridiculous that I have to do this workaround.
formatDateTime(addDays(outputs('Compose'),1), 'M/d')
This JSON in Column settings -> Format this column -> Advanced mode fixed the day issue:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=toLocaleDateString(@currentField)"
}
I guess this gave me an opportunity to learn about https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#detailed-syntax-reference.
- rwittelsFeb 08, 2021Copper Contributor
Although the JSON corrects the way dates are displayed in my SharePoint list, Power Automate matches dates in my list minus one day against today's date. This is so confusing!
For example my SharePoint list has the items:
User1 with birthday date 2/8/1985
User2 with birthday date 2/9/1970
(dates are formatted as M/d/yyyy)
My flow has a Apply to each loop with this condition to find list dates with today's date:
formatDateTime(outputs('Compose'), 'M/d')
is equal to
formatDateTime(utcNow(),'M/d')
Matching dates append the Title field (User1, User2 etc.) to a string variable which is then used in an email.If today is 8 February, my flow should return Titles with dates matching today, such as User1. But it is returning User2!So, the date fix seems to be cosmetic and does not actually fix the underlying issue of SharePoint removing a day from each date.Right now, the only way my outputs work is if I add one day to each date in Excel and then import the list without doing the JSON formatting. The dates appear wrong in SharePoint but my flow matches dates correctly.Any help with this will be appreciated.- rwittelsFeb 08, 2021Copper Contributor
This fixes the output but really ridiculous that I have to do this workaround.
formatDateTime(addDays(outputs('Compose'),1), 'M/d')