Moment JS fromNow() Example




Hii Guys,

In this example,I will learn you how to moment js humanize duration in can easy and simply moment js humanize duration in laravel.

Here, i will give you simple example of jquery moment js fromNow() method provide you humanize duration.

Example :

<!DOCTYPE html>



<title>Moment JS Humanize Duration example -</title>

<script src="" crossorigin="anonymous"></script>

<script src="" crossorigin="anonymous"></script>



<h1> Moment JS Humanize Duration Example -</h1>


<script type="text/javascript">

var monthAgo = moment().subtract(2, 'months').fromNow();


var startDateTime = '05-06-2021'

var dayAgo = moment(startDateTime, "DD-MM-YYYY") .fromNow();




Output :

2 months ago

3 days ago

It will help you...