Monday before
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!
-
Hi Mark,
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
moment(@datefield).isoWeekday(1).toDate()
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()Rainer
Please sign in to leave a comment.
Comments
2 comments