I have an app where I need to create a calculated date field that displays the Monday before an input Date Field in the app. I'm assuming there's some simple way to do this, but I have no idea, so hoping someone can help. Thanks!
if day = Tue, Wed, Thu, Fri, Sat, Sun this would show the Monday of the same week (e.g. for Sun 18th, Monday 12th) as a date
if day = Monday it would show the same Monday. If you want for a Monaday the Monday before:
var date = @datefield;
moment(date).isoWeekday() == 1 ? moment(date).isoWeekday(-6).toDate() : moment(date).isoWeekday(1).toDate()
Please sign in to leave a comment.