Show the date with the smallest order of magnitude of difference from now.
closest
calendar
magnitude
relativeDate
moment.relativeDate.today = "Today at %t";
moment().closest() // Today at 1pm
moment().add('hours', 1).closest() // Today at 2pm
moment.relativeDate.tomorrow = "Tomorrow at %t";
moment().subtract('days', 1).closest() // Tomorrow at 1pm
moment.relativeDate.yesterday = "Yesterday at %t";
moment().subtract('days', 1).closest() // Yesterday at 1pm
moment.relativeDate.last = "Last %d at %t";
moment.relativeDate.yesterday = "Next %d at %t";
moment().subtract('days', 7).closest() // Last Sunday at 1pm
moment().subtract('days', 6).closest() // Last Saturday at 1pm
moment().add('days', 6).closest() // Next Saturday at 1pm
moment().add('days', 7).closest() // Next Sunday at 1pm
moment.relativeDate.else = "L"; // a formatting string
moment().add('weeks', 2).closest() // 7/10/1986
@timwood: Thanks for the link. Unfortunatly this code does not really work. If you choose to display s.th. that is tomorrow, yet in less than 24h, it'll display "Today".