Every line of 'moment from now' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
235 public toFromNow(): string { 236 return moment.utc(this.value).fromNow(); 237 }
164 public fromNow(date) { 165 return moment(date).fromNow(); 166 }
9 getNow() { 10 return this.now; 11 }
6 function fromNow(value:Date): any { 7 if(value){ 8 return moment(value).fromNow(); 9 } 10 }
3 export function fromNow(startDate) { 4 if (typeof startDate === 'string') { 5 startDate = new Date(startDate); 6 } 7 const durationMillis = new Date().getTime() - startDate.getTime(); 8 const duration = moment.duration(durationMillis); 9 if (duration.days() === 0) { 10 return 'today'; 11 } 12 else if (duration.days() === 1) { 13 return 'yesterday'; 14 } 15 else { 16 return moment(startDate).format('MM/DD/YY'); 17 } 18 }
20 function now() { 21 return (new Date()).toISOString() 22 }
23 function utcNowMoment() { 24 return moment.utc(); 25 }
74 get fromNow() { 75 return this.dateFrom(new Date()); 76 }
27 function utcNowMoment() { 28 return exports.moment.utc(); 29 }
36 function getNow () { 37 var d = new Date(); 38 return JSON.parse(JSON.stringify(d).replace('Z', '000Z')); 39 }