relative date moment js code example Example 1: moment to date moment().toDate(); Example 2: moment js from now moment(date).fromNow();