GithubHelp home page GithubHelp logo

f2er / jquery-age Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ksylvest/jquery-age

0.0 2.0 0.0 186 KB

Age is a jQuery plugin that formats and tracks dates and times as human readable text.

Home Page: http://ksylvest.github.io/jquery-age/

License: MIT License

jquery-age's Introduction

jQuery Age

Age is a jQuery plugin that formats and tracks dates and times as human readable text.

Installation

To install copy the javascripts directories into your project and add the following snippet to the header:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js" type="text/javascript"></script>
<script src="javascript/jquery.age.js" type="text/javascript"></script>

This plugin is also registered under http://bower.io/ to simplify integration. Try:

npm install -g bower
bower install gridly

Examples

Setting up a date or time is easy. The following snippet is a good start:

<time datetime="2010-01-01T12:00:00Z" class="age">January 1, 2010 12:00</time>
<time datetime="2020-01-01T12:00:00Z" class="age">January 1, 2020 12:00</time>

<script type="text/javascript">
  $('.age').age();
</script>

Configuration

Age supports a number of configuration settings for customizing the language and intervals:

$('.age').age({
  interval: 10000,
  suffixes: {
    past: "ago",
    future: "until",
    },
  formats: {
    now: "now"
    singular: {
      seconds: "a second",
      minutes: "a minute",
      hours: "a hour",
      days: "a day",
      weeks: "a week",
      months: "a month",
      years: "a year",
      },
    plural: {
      seconds: "{{amount}} seconds",
      minutes: "{{amount}} minutes",
      hours: "{{amount}} hours",
      days: "{{amount}} days",
      weeks: "{{amount}} weeks",
      months: "{{amount}} months",
      years: "{{amount}} years",
      },
    },
  });

);

Copyright

Copyright (c) 2013 - 2013 Kevin Sylvestre. See LICENSE for details.

jquery-age's People

Contributors

ksylvest avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.