Last active
December 30, 2015 15:48
-
-
Save wgrrrr/7850241 to your computer and use it in GitHub Desktop.
C# ASP.NET MVC JavaScript relative TimeAgoInWords using jQuery Timeago plugin. Place the Helpers.cshtml file (or its contents) into your App_Code directory.
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
$(function() { | |
$("time.timeago").timeago(); | |
}); |
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
@helper TimeAgoInWords(DateTime dateTime) { | |
<time class="timeago" datetime="@dateTime.ToString("yyyy-MM-ddTHH:mm:ssK")" title="@dateTime.ToString("f")"> | |
@dateTime.ToString("f") | |
</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
@Helpers.TimeAgoInWords(DateTime.Now) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment