jQuery Plugin To Render Time In Users' Timezone - usertime.js

jQuery Plugin To Render Time In Users' Timezone - usertime.js
File Size: 7.37 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

usertime.js is an ultra-light time manipulation plugin that parses, formats and displays ISO 8601 date and Unix timestamp in users' timezone.

How to use it:

1. The plugin requires jQuery library and moment.js loaded in your document.

<script src="/path/to/jquery-1.11.3.min.js"></script>
<script src="/path/to/moment.min.js"></script>

2. Include the usertime.js after jQuery library.

<script src="/path/to/usertime.js"></script>

3. That's it. The plugin will convert ...

<usertime>1441099707112</usertime>
<usertime>2015-09-03T09:28:27+00:00</usertime>

to ...

2015-09-01 17:28:27
2015-09-03 17:28:27

4. Customize the output format.

<usertime format="lll">1441099707112</usertime>

<!-- output -->

Sep 1, 2015 5:28 PM

Change log:

2016-08-26

  • Fixed MutationsObserver detection behavior.

2016-08-23

  • Added MutationObserver detection.

2015-10-24

  • Support turbolink.

This awesome jQuery plugin is developed by emn178. For more Advanced Usages, please check the demo page or visit the official website.