pnp / List-Formatting

List Formatting Samples for use in SharePoint and Microsoft Lists
https://pnp.github.io/List-Formatting/
MIT License
1.7k stars 823 forks source link

Set Date to Today's Date (Date Only) #764

Closed michelcarlo closed 5 months ago

michelcarlo commented 5 months ago

This sample a button to 'Mark Trip as Complete' (Date Field). This button uses the 'setValue' action to set a Date field value to Today's date by using the token @now and formatting it in a way that we exclude the time piece (a string in the format ‘yyyy-MM-dd’).

Q A
Bug fix? no
New sample? yes
Related issues? none

What's in this Pull Request?

New list formatting sample, to set a Date only field to the Current Date. Natively we can use the @now token but that gets the hours and minutes too, this sample removes the hours/minutes and saves only the date in the field.

tecchan1107 commented 5 months ago

Thank you for the very useful sample @michelcarlo 🤩😍🙏✨

michelcarlo commented 5 months ago

No worries @tecchan1107!! Thanks for reviewing it!🙏