Skip to content

Commit

Permalink
Use niut as external dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
AxFab committed Oct 1, 2016
1 parent e1d069a commit 2cc1786
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 236 deletions.
15 changes: 12 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Git ignore for JS code
# =======================================================
# GitIgnore '.gitignore' for JS code
# Fabien B. <fabien.bavent@gmail.com>
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# =======================================================

# Use file white-list and folder black-list
*
Expand All @@ -7,6 +14,7 @@
# Remove building folders
[Bb]in/
[Cc]overage/
[Nn]ode_modules/

# Add source file
!*.js
Expand All @@ -15,5 +23,6 @@
# Add repository files
!*.md
!.git*
!LICENSE

!.npm*
!.travis.yml
![A-Z]*
26 changes: 26 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# =======================================================
# NpmIgnore '.npmignore' for JS code
# Fabien B. <fabien.bavent@gmail.com>
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# =======================================================

# Use file white-list and folder black-list
*
!*/

# Remove building folders
[Bb]in/
[Cc]overage/
[Nn]ode_modules/

# Add source file
!*.js
!*.json

# Add repository files
!*.md
!.git*
![A-Z]*
22 changes: 16 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jdx",
"version": "0.2.0",
"version": "0.2.1",
"description": "Extension for JavaScript date (format and parse)",
"main": "jdx.js",
"scripts": {
Expand All @@ -20,14 +20,24 @@
"parse"
],
"devDependencies": {
"istanbul": "^0.4.0",
"coveralls": "^2.11.0",
"uglify-js": "^2.7.0"
"niut": "0.1.*",
"istanbul": "0.4.*",
"coveralls": "^2.11.*",
"uglify-js": "2.7.*"
},
"author": {
"name": "Fabien Bavent",
"email": "fabien.bavent@gmail.com"
},
"author": "Fabien Bavent <fabien.bavent@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/AxFab/jdx/issues"
},
"homepage": "https://github.com/AxFab/jdx#readme"
"homepage": "https://github.com/AxFab/jdx#readme",
"readme": "# jDx\n\nExtension for JavaScript date (format and parse)\n\n[![Npm version](https://badge.fury.io/js/jdx.svg)](https://badge.fury.io/js/jdx)\n&nbsp;\n[![Npm download](https://img.shields.io/npm/dm/jdx.svg)](https://www.npmjs.com/package/jdx)\n&nbsp;\n[![Build Status](https://api.travis-ci.org/AxFab/jdx.svg?branch=master)](http://travis-ci.org/axfab/jdx)\n&nbsp;\n[![Coverage Status](https://img.shields.io/coveralls/AxFab/jdx.svg)](https://coveralls.io/r/AxFab/jdx?branch=master)\n&nbsp;\n[![Dependencies](https://david-dm.org/AxFab/jdx.svg)](https://david-dm.org/AxFab/jdx)\n\n## Installation\n\n__jDx__ library have been tested on NodeJS and on most browsers.\n\nOn node:\n\n npm install jdx\n\nOn browser:\n\n <script src=\"/dist/js/jdx.min.js\" integrity=\"sha384-tj1IdTxBhXxBdA0/P1vSAM86XtU0Rtl2mDdEkYk9UTDLIDq+DiodnY/IdhP2Pt/n\"></script>\n\n## Usage\n\nThe library provide one item with one function to format dates and another \nto parse dates.\n\n### Format dates:\n\n - `jDx.formatDate(mask);`\n - `jDx.formatDate(date[, mask [, utc]]);`\n\n - `date`: Provide a javascript `Date` object to format. Default to `new Date()`.\n - `mask`: The format requested can be either a name or an expression. See _Patterns_ and _Language_ to know more. Default is 'default'.\n - `utc`: Boolean value, if `true` will display UTC time, else local time. Default is `false`.\n\n```js\nvar jDx = require('jdx');\n\njDx.formatDate(new Date()); // return 'Sun Sep 25 2016 13:06:24'\njDx.formatDate(new Date(), 'mmmm yyyy'); // return 'September 2016'\njDx.formatDate('isoUtcDateTime'); // return '2016-09-25T11:06:24Z'\n```\n\n\n### Parse dates:\n\n - `jDx.parseDate(date[, mask [, utc]]);`\n\n - `date`: A string representing a date.\n - `mask`: The format used by the string representation. Can be either a name or an expression. If none is provided the function will try with known pattern including previously used. See _Patterns_ and _Language_ to know more.\n - `utc`: Boolean value, if `true` will consider _date_ as in UTC time, else in local time. Default is `false`.\n\n```js\nvar jDx = require('jdx');\n\njDx.formatDate('Sun Sep 25 2016 13:06:24'); // equals to `Sun Sep 25 2016 13:06:24 GMT+0200`\njDx.formatDate('September 2016', 'mmmm yyyy'); // equals to `Sun Sep 01 2016 00:00:00 GMT+0200`\njDx.formatDate('2016-09-25T11:06:24Z'); // equals to `Sun Sep 25 2016 13:06:24 GMT+0200`\n```\n\n## Patterns\n\nThe expression provide to those previous functions will recognize those patterns\n\n - `d`: The day of the month.\n - `dd`: The day of the month on two digits.\n - `ddd`: A short representation of the day of the week (3 characters).\n - `dddd`: The name of the day of the week.\n - `m`: The number of the month.\n - `mm`: The number of the month on two digits.\n - `mmm`: A short representation of the month.\n - `mmmm`: The name of the month.\n - `yy`: The last two digits of the current year.\n - `yyyy`: The year on four digits.\n - `h`: The hours on a 12 hours clock.\n - `hh`: The hours on a 12 hours clock on two digits.\n - `H`: The hours on a 24 hours clock.\n - `HH`: The hours on a 24 hours clock on two digits.\n - `M`: The minutes.\n - `MM`: The minutes on two digits.\n - `s`: The seconds.\n - `ss`: The seconds on two digits.\n - `l`: The milliseconds on three digits.\n - `L`: The hundreads of seconds on two digits.\n - `t`: The _meridiem_ (_a_ or _p_)\n - `tt`: The _meridiem_ (_am_ or _pm_)\n - `T`: The _meridiem_ (_A_ or _P_)\n - `TT`: The _meridiem_ (_AM_ or _PM_)\n - `Z`: The local time offset (_UTC_ or _GMT+0000_)\n - `o`: The local time offset in minutes\n - `S`: Day of the month suffix (_th_, _st_, _nd_ or _rd_).\n\nTo include extra characters, put them into quote __''__.\n\nThe library alreay know some default pattern. See _Languages_.\n\n## Languages\n\nThe library support english as default language. However it's possible to\nconfigure the library differently.\n\n - `jDx.setLang(lang)`: Change the days and month names used by the library. Some pattern might change too.\n\nNote that pattern are more localization (l10n) than internationalization (i18n)\nhowever the library is not mature enough to handle the difference perfectly but still provide \nway to change the formats availables.\n\nThe languages supported are: `en`, `fr` and `es`.\n\nFormat | English | French | Spanish\n---------------|----------------------------|----------------------------|---------\ndefault | Sun Sep 25 2016 13:48:02 | Dim 25 Sep 2016 13:50:52 | Dom 25-IX-2016 13:52:33\nshortDate | 9/25/16 | 25/9/16 | 25/9/16\nmediumDate | Sep 25, 2016 | 25 Sep 2016 | 25-IX-2016\nlongDate | September 25, 2016 | 25 Septembre 2016 | 25 de septiembre de 2016\nfullDate | Sunday, September 25, 2016 | Dimanche 25 Septembre 2016 | Domingo 25 de septiembre de 2016\nshortTime | 1:48 PM | 13:50 | 13:52\nmediumTime | 1:48:02 PM | 13:50:52 | 13:52:33\nlongTime | 1:48:02 PM GMT+0200 | 13:50:52 GMT+0200 | 13:52:33 GMT+0200\n\nFormat | Values\n---------------|-----------------------\nsortableDate | 2016/09/25\nisoDate | 2016-09-25\nisoTime | 13:48:02\nisoDateTime | 2016-09-25T13:48:02\nisoUtcDateTime | 2016-09-25T11:48:02Z\n\n\n## Contributing\n\nPlease report to me any bug you find. And any help is most welcome especialy for \ninternationalization and localization.\n\n",
"readmeFilename": "README.md",
"gitHead": "e1d069ab2f64856adf7ecab74162450b7720a309",
"_id": "jdx@0.2.1",
"_shasum": "e011c1c62e8cd3db111e550dfcfba2632f744420",
"_from": "jdx@*"
}
2 changes: 1 addition & 1 deletion tests/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

var jDx = jDx || require('../jdx.js'),
niut = niut || require ('./niut.js'),
niut = niut || require ('niut'),
suite = niut.newSuite('Validator');

var timezones = [ 'locale' ];
Expand Down
226 changes: 0 additions & 226 deletions tests/niut.js

This file was deleted.

0 comments on commit 2cc1786

Please sign in to comment.