-
-
Save singhmohancs/fd2a5f91387f1f1f73edce54e40403d1 to your computer and use it in GitHub Desktop.
Moment.JS - Convert UTC to Local Time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.format = function() { | |
return this.each(function() { | |
var $this = $(this); | |
var time = $this.attr("datetime"); | |
var localTime = moment.utc(time).local().format(); | |
$this.attr("datetime", localTime).timeago(); | |
return this; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: