Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Unix (strftime) and php format translations for momentjs

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.rst

moment-tokens

Some usefull tokens translations for momentjs, this library adds strftime method for unix style and phpFormat for php formating tokens. This library only translates tokes to the native momentjs tokens.

Compatibility

  • Browser (Tested on Chrome, Firefox, Opera)
  • Nodejs

Instalation

Actually, you can download the raw moment-tokens.js or clone this repository. In the near future I add this package to npm for nodejs users.

Usage

NOTE: moment-tokens just adds some aditional methods to moment.

In the browser is as simple as:

<script src="js/moment.js"></script>
<script src="js/moment-tokens.js"></script>
<script>
console.log(moment().strftime("%m/%d/%y %I:%M %p %Z"));
// This prints on console: ``01/17/12 08:54 PM EST``
</script>

Same way on nodejs:

var moment = require("moment-tokens");
console.log(moment().strftime("%m/%d/%y %I:%M %p %Z"));

TODO

  • strptime - parse dates with unix tokens
  • phpparse - parse dates with php tokens

Contributing

Be free to send pull-request.

License

BSD License

Something went wrong with that request. Please try again.