rmm5t/jquery-timeago
Composer 安装命令:
composer require rmm5t/jquery-timeago
包简介
jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago").
关键字:
README 文档
README
Timeago is a jQuery plugin that makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago") from ISO 8601 formatted dates and times embedded in your HTML (à la microformats).
Usage
First, load jQuery and the plugin:
<script src="jquery.min.js" type="text/javascript"></script> <script src="jquery.timeago.js" type="text/javascript"></script>
Now, let's attach it to your timestamps on DOM ready - put this in the head section:
<script type="text/javascript"> jQuery(document).ready(function() { $("time.timeago").timeago(); }); </script>
This will turn all <time> elements with a class of timeago and a
datetime attribute formatted according to the
ISO 8601 standard:
<time class="timeago" datetime="2011-12-17T09:24:17Z">December 17, 2011</time>
into something like this:
<time class="timeago" datetime="2011-12-17T09:24:17Z" title="December 17, 2011">about 1 day ago</time>
<abbr> elements (or any other HTML elements) are also supported (this is for
legacy microformat support
and was originally supported by the library before the time element was
introduced to HTML5):
<abbr class="timeago" title="2011-12-17T09:24:17Z">December 17, 2011</abbr>
As time passes, the timestamps will automatically update.
If you want to update a timestamp programatically later, call the update
function with a new ISO8601 timestamp of Date object. For example:
$("time#some_id").timeago("update", "2013-12-17T09:24:17Z"); // or $("time#some_id").timeago("update", new Date());
For more usage and examples: http://timeago.yarp.com/
For different language configurations: visit the locales directory.
Settings
cutoff : Return the original date if time distance is older than cutoff (miliseconds).
// Display original dates older than 24 hours jQuery.timeago.settings.cutoff = 1000*60*60*24;
Changes
| Version | Notes |
|---|---|
| 1.6.x | (compare) Wraped locales in UMD wrappers; locale improvements |
| 1.5.x | (compare) Added Date as argument to update function; locales |
| 1.4.x | (compare) Added allowPast setting; locale updates |
| 1.3.x | (compare) Added updateFromDOM function; bug fixes; bower support |
| 1.2.x | (compare) Added cutoff setting; locale updates |
| 1.1.x | (compare) Added update function; locale updates |
| 1.0.x | (compare) locale updates; bug fixes; AMD wrapper |
| 0.11.x | (compare) natural rounding; locale updates; |
| 0.10.x | (compare) locale updates |
| 0.9.x | (compare) microsecond support; bug fixes |
| 0.8.x | (compare) <time> element support; bug fixes |
| 0.7.x | (compare) locale function overrides; unit tests |
| ... | ... |
Author
License
rmm5t/jquery-timeago 适用场景与选型建议
rmm5t/jquery-timeago 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 181.6k 次下载、GitHub Stars 达 3.8k, 最近一次更新时间为 2016 年 07 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「time」 「microformat」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rmm5t/jquery-timeago 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rmm5t/jquery-timeago 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rmm5t/jquery-timeago 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Tools to convert between .NET and PHP date formats
Adds the EDTF data type to Wikibase
Date component is a set of methods to help with the manipulation of dates.
Bureaux A Partager Edit - Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js
Delayed Process For Laravel.
Temporal frequency library
统计信息
- 总下载量: 181.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3800
- 点击次数: 27
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-05