Created
July 26, 2015 22:59
-
-
Save fntneves/c791939bd71df4d6b479 to your computer and use it in GitHub Desktop.
Moment.JS - Convert UTC to Local Time
This file contains hidden or 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
Nice! thank you for posting