Monday before

Comments

2 comments

  • Rainer Grabowski

    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

    0
    Comment actions Permalink
  • Mark Lanks

    Rainer-

    Perfect!  I appreciate it.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk