Pushing changes
This commit is contained in:
15
node_modules/date-format/.npmignore
generated
vendored
Normal file
15
node_modules/date-format/.npmignore
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
npm-debug.log
|
||||
node_modules
|
20
node_modules/date-format/LICENSE
generated
vendored
Normal file
20
node_modules/date-format/LICENSE
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Gareth Jones
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
node_modules/date-format/README.md
generated
vendored
Normal file
26
node_modules/date-format/README.md
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
date-format
|
||||
===========
|
||||
|
||||
node.js formatting of Date objects as strings. Probably exactly the same as some other library out there.
|
||||
|
||||
npm install date-format
|
||||
|
||||
usage
|
||||
=====
|
||||
|
||||
var format = require('date-format');
|
||||
format.asString(new Date()); //defaults to ISO8601 format
|
||||
format.asString('hh:mm:ss.SSS', new Date()); //just the time
|
||||
|
||||
Format string can be anything, but the following letters will be replaced (and leading zeroes added if necessary):
|
||||
* dd - date.getDate()
|
||||
* MM - date.getMonth() + 1
|
||||
* yy - date.getFullYear().toString().substring(2, 4)
|
||||
* yyyy - date.getFullYear()
|
||||
* hh - date.getHours()
|
||||
* mm - date.getMinutes()
|
||||
* ss - date.getSeconds()
|
||||
* SSS - date.getMilliseconds()
|
||||
* O - timezone offset in +hm format
|
||||
|
||||
That's it.
|
66
node_modules/date-format/lib/index.js
generated
vendored
Normal file
66
node_modules/date-format/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
exports.ISO8601_FORMAT = "yyyy-MM-dd hh:mm:ss.SSS";
|
||||
exports.ISO8601_WITH_TZ_OFFSET_FORMAT = "yyyy-MM-ddThh:mm:ssO";
|
||||
exports.DATETIME_FORMAT = "dd MM yyyy hh:mm:ss.SSS";
|
||||
exports.ABSOLUTETIME_FORMAT = "hh:mm:ss.SSS";
|
||||
|
||||
function padWithZeros(vNumber, width) {
|
||||
var numAsString = vNumber + "";
|
||||
while (numAsString.length < width) {
|
||||
numAsString = "0" + numAsString;
|
||||
}
|
||||
return numAsString;
|
||||
}
|
||||
|
||||
function addZero(vNumber) {
|
||||
return padWithZeros(vNumber, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the TimeOffest
|
||||
* Thanks to http://www.svendtofte.com/code/date_format/
|
||||
* @private
|
||||
*/
|
||||
function offset(date) {
|
||||
// Difference to Greenwich time (GMT) in hours
|
||||
var os = Math.abs(date.getTimezoneOffset());
|
||||
var h = String(Math.floor(os/60));
|
||||
var m = String(os%60);
|
||||
if (h.length == 1) {
|
||||
h = "0" + h;
|
||||
}
|
||||
if (m.length == 1) {
|
||||
m = "0" + m;
|
||||
}
|
||||
return date.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m;
|
||||
}
|
||||
|
||||
exports.asString = function(/*format,*/ date) {
|
||||
var format = exports.ISO8601_FORMAT;
|
||||
if (typeof(date) === "string") {
|
||||
format = arguments[0];
|
||||
date = arguments[1];
|
||||
}
|
||||
|
||||
var vDay = addZero(date.getDate());
|
||||
var vMonth = addZero(date.getMonth()+1);
|
||||
var vYearLong = addZero(date.getFullYear());
|
||||
var vYearShort = addZero(date.getFullYear().toString().substring(2,4));
|
||||
var vYear = (format.indexOf("yyyy") > -1 ? vYearLong : vYearShort);
|
||||
var vHour = addZero(date.getHours());
|
||||
var vMinute = addZero(date.getMinutes());
|
||||
var vSecond = addZero(date.getSeconds());
|
||||
var vMillisecond = padWithZeros(date.getMilliseconds(), 3);
|
||||
var vTimeZone = offset(date);
|
||||
var formatted = format
|
||||
.replace(/dd/g, vDay)
|
||||
.replace(/MM/g, vMonth)
|
||||
.replace(/y{1,4}/g, vYear)
|
||||
.replace(/hh/g, vHour)
|
||||
.replace(/mm/g, vMinute)
|
||||
.replace(/ss/g, vSecond)
|
||||
.replace(/SSS/g, vMillisecond)
|
||||
.replace(/O/g, vTimeZone);
|
||||
return formatted;
|
||||
|
||||
};
|
87
node_modules/date-format/package.json
generated
vendored
Normal file
87
node_modules/date-format/package.json
generated
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "date-format@^0.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "date-format",
|
||||
"name": "date-format",
|
||||
"rawSpec": "^0.0.0",
|
||||
"spec": ">=0.0.0 <0.0.1",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/burchettm/statsbot/node_modules/streamroller"
|
||||
]
|
||||
],
|
||||
"_from": "date-format@>=0.0.0 <0.0.1",
|
||||
"_id": "date-format@0.0.0",
|
||||
"_inCache": true,
|
||||
"_location": "/date-format",
|
||||
"_npmUser": {
|
||||
"name": "csausdev",
|
||||
"email": "gareth.jones@sensis.com.au"
|
||||
},
|
||||
"_npmVersion": "1.2.18",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "date-format@^0.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "date-format",
|
||||
"name": "date-format",
|
||||
"rawSpec": "^0.0.0",
|
||||
"spec": ">=0.0.0 <0.0.1",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/streamroller"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/date-format/-/date-format-0.0.0.tgz",
|
||||
"_shasum": "09206863ab070eb459acea5542cbd856b11966b3",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "date-format@^0.0.0",
|
||||
"_where": "/home/burchettm/statsbot/node_modules/streamroller",
|
||||
"author": {
|
||||
"name": "Gareth Jones",
|
||||
"email": "gareth.jones@sensis.com.au"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nomiddlename/date-format/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "formatting Date objects as strings since 2013",
|
||||
"devDependencies": {
|
||||
"mocha": "~1.12.0",
|
||||
"should": "~1.2.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "09206863ab070eb459acea5542cbd856b11966b3",
|
||||
"tarball": "https://registry.npmjs.org/date-format/-/date-format-0.0.0.tgz"
|
||||
},
|
||||
"gitHead": "bf59015ab6c9e86454b179374f29debbdb403522",
|
||||
"homepage": "https://github.com/nomiddlename/date-format#readme",
|
||||
"keywords": [
|
||||
"date",
|
||||
"format",
|
||||
"string"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "csausdev",
|
||||
"email": "gareth.jones@sensis.com.au"
|
||||
}
|
||||
],
|
||||
"name": "date-format",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/nomiddlename/date-format.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
}
|
42
node_modules/date-format/test/date_format-test.js
generated
vendored
Normal file
42
node_modules/date-format/test/date_format-test.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
var should = require('should')
|
||||
, dateFormat = require('../lib');
|
||||
|
||||
describe('date_format', function() {
|
||||
var date = new Date(2010, 0, 11, 14, 31, 30, 5);
|
||||
|
||||
it('should format a date as string using a pattern', function() {
|
||||
dateFormat.asString(dateFormat.DATETIME_FORMAT, date).should.eql("11 01 2010 14:31:30.005");
|
||||
});
|
||||
|
||||
it('should default to the ISO8601 format', function() {
|
||||
dateFormat.asString(date).should.eql('2010-01-11 14:31:30.005');
|
||||
});
|
||||
|
||||
it('should provide a ISO8601 with timezone offset format', function() {
|
||||
date.getTimezoneOffset = function() { return -660; };
|
||||
dateFormat.asString(
|
||||
dateFormat.ISO8601_WITH_TZ_OFFSET_FORMAT,
|
||||
date
|
||||
).should.eql(
|
||||
"2010-01-11T14:31:30+1100"
|
||||
);
|
||||
|
||||
date.getTimezoneOffset = function() { return 120; };
|
||||
dateFormat.asString(
|
||||
dateFormat.ISO8601_WITH_TZ_OFFSET_FORMAT,
|
||||
date
|
||||
).should.eql(
|
||||
"2010-01-11T14:31:30-0200"
|
||||
);
|
||||
});
|
||||
|
||||
it('should provide a just-the-time format', function() {
|
||||
dateFormat.asString(dateFormat.ABSOLUTETIME_FORMAT, date).should.eql('14:31:30.005');
|
||||
});
|
||||
|
||||
it('should provide a custom format', function() {
|
||||
date.getTimezoneOffset = function() { return 120; };
|
||||
dateFormat.asString("O.SSS.ss.mm.hh.dd.MM.yy", date).should.eql('-0200.005.30.31.14.11.01.10');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user