node-log4js-6.9.1+~cs8.4.19/000077500000000000000000000000001451773721600151525ustar00rootroot00000000000000node-log4js-6.9.1+~cs8.4.19/CHANGELOG.md000066400000000000000000000170541451773721600167720ustar00rootroot00000000000000# date-format Changelog ## 4.0.14 - [chore(deps-dev): updated dependencies](https://github.com/nomiddlename/date-format/pull/86) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): bump eslint from 4.19.1 to 8.24.0 - chore(deps-dev): bump eslint-plugin-mocha from 4.12.1 to 10.1.0 - chore(deps-dev): bump mocha from 5.2.0 to 10.0.0 - chore(deps-dev): bump nyc from 13.0.0 to 15.1.0 - [ci: manually downgrade dev dependencies for older versions](https://github.com/nomiddlename/date-format/pull/87) - thanks [@lamweili](https://github.com/lamweili) - [ci: separated npm audit](https://github.com/nomiddlename/date-format/pull/85) - thanks [@lamweili](https://github.com/lamweili) - [ci: updated codeql from v1 to v2](https://github.com/nomiddlename/date-format/pull/80) - thanks [@lamweili](https://github.com/lamweili) ## 4.0.13 - [ci: added tests for Node.js 4.x, 6.x, 8.x, 10.x, 18.x](https://github.com/nomiddlename/date-format/pull/75) - thanks [@lamweili](https://github.com/lamweili) - [chore(deps-dev): bump hosted-git-info from 2.6.0 to 2.8.9](https://github.com/nomiddlename/date-format/pull/76) - thanks [@Dependabot](https://github.com/dependabot) - [chore(deps-dev): bump handlebars from 4.0.11 to 4.7.7 ](https://github.com/nomiddlename/date-format/pull/77) - thanks [@Dependabot](https://github.com/dependabot) - [chore(deps-dev): bump y18n from 3.2.1 to 3.2.2](https://github.com/nomiddlename/date-format/pull/78) - thanks [@Dependabot](https://github.com/dependabot) ## 4.0.12 - [ci: added tests for Node.js 8.x, 10.x, 18.x](https://github.com/nomiddlename/date-format/pull/73) - thanks [@lamweili](https://github.com/lamweili) - [docs: renamed peteriman to lamweili](https://github.com/nomiddlename/date-format/pull/72) - thanks [@lamweili](https://github.com/lamweili) ## 4.0.11 - [fix: date parsing errors (wrong month due to days overflow)](https://github.com/nomiddlename/date-format/pull/68) - thanks [@lamweili](https://github.com/lamweili) - [test: use new Date(0) instead of new Date() before setting every field]() - thanks [@lamweili](https://github.com/lamweili) - [chore(deps-dev): updated dependencies](https://github.com/nomiddlename/date-format/pull/70) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): bump eslint from 8.15.0 to 8.16.0 - chore(deps-dev): bump eslint-plugin-mocha from 10.0.4 to 10.0.5 - chore(deps-dev): updated package-lock.json ## 4.0.10 - [chore(deps-dev): updated dependencies](https://github.com/nomiddlename/date-format/pull/66) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): bump eslint from 8.14.0 to 8.15.0 - chore(deps-dev): bump mocha from 9.2.2 to 10.0.0 - chore(deps-dev): updated package-lock.json ## 4.0.9 - build: is exactly the same as 4.0.8 and is a re-published 4.0.8 to npm ## 4.0.8 - [chore(deps-dev): updated dependencies](https://github.com/nomiddlename/date-format/pull/60) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): bump eslint from 8.13.0 to 8.14.0 - chore(deps-dev): updated package-lock.json - [chore(deps-dev): updated dependencies](https://github.com/nomiddlename/date-format/pull/59) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): updated package-lock.json ## 4.0.7 - [chore(deps-dev): updated dependencies](https://github.com/nomiddlename/date-format/pull/57) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): bump eslint-plugin-mocha from 10.0.3 to 10.0.4 - chore(deps-dev): updated package-lock.json - [chore(deps-dev): updated dependencies](https://github.com/nomiddlename/date-format/pull/54) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): bump eslint from 8.11.0 to 8.13.0 - chore(deps-dev): updated package-lock.json ## 4.0.6 - [chore(deps-dev): updated dependencies](https://github.com/nomiddlename/date-format/pull/52) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): updated package-lock.json ## 4.0.5 - [test: better test coverage instead of ignoring](https://github.com/nomiddlename/date-format/pull/48) - thanks [@lamweili](https://github.com/lamweili) - [docs: updated README.md with badges](https://github.com/nomiddlename/date-format/pull/50) thanks [@lamweili](https://github.com/lamweili) - [chore(deps-dev): updated dependencies](https://github.com/nomiddlename/date-format/pull/49) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): bump eslint from 8.10.0 to 8.11.0 - chore(deps-dev): bump mocha from 9.2.1 to 9.2.2 - chore(deps-dev): updated package-lock.json ## 4.0.4 - chore(deps-dev): updated dependencies - thanks [@lamweili](https://github.com/lamweili) - [chore(deps-dev): bump eslint from 8.8.0 to 8.10.0 and mocha from 9.2.0 to 9.2.1](https://github.com/nomiddlename/date-format/pull/46) - [chore(deps-dev): bump eslint from 8.7.0 to 8.8.0 and mocha from 9.1.4 to 9.2.0](https://github.com/nomiddlename/date-format/pull/45) - [chore(deps-dev): updated package-lock.json](https://github.com/nomiddlename/date-format/pull/44) ## 4.0.3 - [test: 100% test coverage](https://github.com/nomiddlename/date-format/pull/42) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): updated dependencies - thanks [@lamweili](https://github.com/lamweili) - [chore(deps-dev): bump eslint from 8.6.0 to 8.7.0 and mocha from 9.1.3 to 9.1.4](https://github.com/nomiddlename/date-format/pull/41) ## 4.0.2 - [build: not to publish misc files to NPM](https://github.com/nomiddlename/date-format/pull/39) - thanks [@lamweili](https://github.com/lamweili) - docs: CHANGELOG.md - [docs: removed "log4js" from title of CHANGELOG.md](https://github.com/nomiddlename/date-format/pull/37) - thanks [@joshuabremerdexcom](https://github.com/joshuabremerdexcom) - [docs: added "date-format" to title of CHANGELOG.md](https://github.com/nomiddlename/date-format/commit/64a95d0386853692d7d65174f94a0751e775f7ce#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): updated dependencies - thanks [@lamweili](https://github.com/lamweili) - [chore(deps-dev): bump eslint-plugin-mocha from 5.3.0 to 10.0.3](https://github.com/nomiddlename/date-format/pull/38) ## 4.0.1 - build: is exactly the same as 4.0.0 and is a re-published 4.0.0 to npm ## 4.0.0 - [fix: timezone format to include colon separator](https://github.com/nomiddlename/date-format/pull/27) - thanks [@lamweili](https://github.com/lamweili) - [test: have a test case for timezone with colon](https://github.com/nomiddlename/date-format/pull/32) - thanks [@lamweili](https://github.com/lamweili) - [docs: updated README.md with more examples and expected output](https://github.com/nomiddlename/date-format/pull/33) - thanks [@lamweili](https://github.com/lamweili) - chore(deps-dev): updated dependencies - [chore(deps-dev): bump should-util from 1.0.0 to 1.0.1](https://github.com/nomiddlename/date-format/pull/31) - thanks [@lamweili](https://github.com/lamweili) - [chore(deps-dev): bump eslint from 5.16.0 to 8.6.0 and mocha from 5.2.0 to 9.1.3](https://github.com/nomiddlename/date-format/pull/30) - thanks [@lamweili](https://github.com/lamweili) - [chore(deps-dev): bump acorn from 6.2.0 to 6.4.2](https://github.com/nomiddlename/date-format/pull/29) - thanks [@Dependabot](https://github.com/dependabot) - [chore(deps-dev): bump lodash from 4.17.14 to 4.17.21](https://github.com/nomiddlename/date-format/pull/26) - thanks [@Dependabot](https://github.com/dependabot) ## Previous versions Change information for older versions can be found by looking at the milestones in github. node-log4js-6.9.1+~cs8.4.19/LICENSE000066400000000000000000000020671451773721600161640ustar00rootroot00000000000000The 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. node-log4js-6.9.1+~cs8.4.19/README.md000066400000000000000000000057441451773721600164430ustar00rootroot00000000000000date-format [![CodeQL](https://github.com/nomiddlename/date-format/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/nomiddlename/date-format/actions/workflows/codeql-analysis.yml) [![Node.js CI](https://github.com/nomiddlename/date-format/actions/workflows/node.js.yml/badge.svg)](https://github.com/nomiddlename/date-format/actions/workflows/node.js.yml) =========== [![NPM](https://nodei.co/npm/date-format.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/date-format/) node.js formatting of Date objects as strings. Probably exactly the same as some other library out there. ```sh npm install date-format ``` usage ===== Formatting dates as strings ---- ```javascript var format = require('date-format'); format.asString(); // defaults to ISO8601 format and current date format.asString(new Date()); // defaults to ISO8601 format format.asString('hh:mm:ss.SSS', new Date()); // just the time format.asString(format.ISO8601_WITH_TZ_OFFSET_FORMAT, new Date()); // in ISO8601 with timezone ``` or ```javascript var format = require('date-format'); format(); // defaults to ISO8601 format and current date format(new Date()); // defaults to ISO8601 format format('hh:mm:ss.SSS', new Date()); // just the time format(format.ISO8601_WITH_TZ_OFFSET_FORMAT, new Date()); // in ISO8601 with timezone ``` **output:** ```javascript 2017-03-14T14:10:20.391 2017-03-14T14:10:20.391 14:10:20.391 2017-03-14T14:10:20.391+11:00 ``` 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 ±hh:mm format (note that time will still be local if displaying offset) Built-in formats: * `format.ISO8601_FORMAT` - `2017-03-14T14:10:20.391` (local time used) * `format.ISO8601_WITH_TZ_OFFSET_FORMAT` - `2017-03-14T14:10:20.391+11:00` (local + TZ used) * `format.DATETIME_FORMAT` - `14 03 2017 14:10:20.391` (local time used) * `format.ABSOLUTETIME_FORMAT` - `14:10:20.391` (local time used) Parsing strings as dates ---- The date format library has limited ability to parse strings into dates. It can convert strings created using date format patterns (as above), but if you're looking for anything more sophisticated than that you should probably look for a better library ([momentjs](https://momentjs.com) does pretty much everything). ```javascript var format = require('date-format'); // pass in the format of the string as first argument format.parse(format.ISO8601_FORMAT, '2017-03-14T14:10:20.391'); format.parse(format.ISO8601_WITH_TZ_OFFSET_FORMAT, '2017-03-14T14:10:20.391+1100'); format.parse(format.ISO8601_WITH_TZ_OFFSET_FORMAT, '2017-03-14T14:10:20.391+11:00'); format.parse(format.ISO8601_WITH_TZ_OFFSET_FORMAT, '2017-03-14T03:10:20.391Z'); // returns Date ``` node-log4js-6.9.1+~cs8.4.19/lib/000077500000000000000000000000001451773721600157205ustar00rootroot00000000000000node-log4js-6.9.1+~cs8.4.19/lib/index.js000066400000000000000000000154121451773721600173700ustar00rootroot00000000000000"use strict"; function padWithZeros(vNumber, width) { var numAsString = vNumber.toString(); while (numAsString.length < width) { numAsString = "0" + numAsString; } return numAsString; } function addZero(vNumber) { return padWithZeros(vNumber, 2); } /** * Formats the TimeOffset * Thanks to http://www.svendtofte.com/code/date_format/ * @private */ function offset(timezoneOffset) { var os = Math.abs(timezoneOffset); var h = String(Math.floor(os / 60)); var m = String(os % 60); h = ("0" + h).slice(-2); m = ("0" + m).slice(-2); return timezoneOffset === 0 ? "Z" : (timezoneOffset < 0 ? "+" : "-") + h + ":" + m; } function asString(format, date) { if (typeof format !== "string") { date = format; format = module.exports.ISO8601_FORMAT; } if (!date) { date = module.exports.now(); } // Issue # 14 - Per ISO8601 standard, the time string should be local time // with timezone info. // See https://en.wikipedia.org/wiki/ISO_8601 section "Time offsets from UTC" var vDay = addZero(date.getDate()); var vMonth = addZero(date.getMonth() + 1); var vYearLong = addZero(date.getFullYear()); var vYearShort = addZero(vYearLong.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.getTimezoneOffset()); 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; } function setDatePart(date, part, value, local) { date['set' + (local ? '' : 'UTC') + part](value); } function extractDateParts(pattern, str, missingValuesDate) { // Javascript Date object doesn't support custom timezone. Sets all felds as // GMT based to begin with. If the timezone offset is provided, then adjust // it using provided timezone, otherwise, adjust it with the system timezone. var local = pattern.indexOf('O') < 0; var monthOverflow = false; var matchers = [ { pattern: /y{1,4}/, regexp: "\\d{1,4}", fn: function(date, value) { setDatePart(date, 'FullYear', value, local); } }, { pattern: /MM/, regexp: "\\d{1,2}", fn: function(date, value) { setDatePart(date, 'Month', (value - 1), local); if (date.getMonth() !== (value - 1)) { // in the event of 31 May --> 31 Feb --> 3 Mar // this is correct behavior if no Date is involved monthOverflow = true; } } }, { pattern: /dd/, regexp: "\\d{1,2}", fn: function(date, value) { // in the event of 31 May --> 31 Feb --> 3 Mar // reset Mar back to Feb, before setting the Date if (monthOverflow) { setDatePart(date, 'Month', (date.getMonth() - 1), local); } setDatePart(date, 'Date', value, local); } }, { pattern: /hh/, regexp: "\\d{1,2}", fn: function(date, value) { setDatePart(date, 'Hours', value, local); } }, { pattern: /mm/, regexp: "\\d\\d", fn: function(date, value) { setDatePart(date, 'Minutes', value, local); } }, { pattern: /ss/, regexp: "\\d\\d", fn: function(date, value) { setDatePart(date, 'Seconds', value, local); } }, { pattern: /SSS/, regexp: "\\d\\d\\d", fn: function(date, value) { setDatePart(date, 'Milliseconds', value, local); } }, { pattern: /O/, regexp: "[+-]\\d{1,2}:?\\d{2}?|Z", fn: function(date, value) { if (value === "Z") { value = 0; } else { value = value.replace(":", ""); } var offset = Math.abs(value); var timezoneOffset = (value > 0 ? -1 : 1 ) * ((offset % 100) + Math.floor(offset / 100) * 60); // Per ISO8601 standard: UTC = local time - offset // // For example, 2000-01-01T01:00:00-0700 // local time: 2000-01-01T01:00:00 // ==> UTC : 2000-01-01T08:00:00 ( 01 - (-7) = 8 ) // // To make it even more confusing, the date.getTimezoneOffset() is // opposite sign of offset string in the ISO8601 standard. So if offset // is '-0700' the getTimezoneOffset() would be (+)420. The line above // calculates timezoneOffset to matche Javascript's behavior. // // The date/time of the input is actually the local time, so the date // object that was constructed is actually local time even thought the // UTC setters are used. This means the date object's internal UTC // representation was wrong. It needs to be fixed by substracting the // offset (or adding the offset minutes as they are opposite sign). // // Note: the time zone has to be processed after all other fields are // set. The result would be incorrect if the offset was calculated // first then overriden by the other filed setters. date.setUTCMinutes(date.getUTCMinutes() + timezoneOffset); } } ]; var parsedPattern = matchers.reduce( function(p, m) { if (m.pattern.test(p.regexp)) { m.index = p.regexp.match(m.pattern).index; p.regexp = p.regexp.replace(m.pattern, "(" + m.regexp + ")"); } else { m.index = -1; } return p; }, { regexp: pattern, index: [] } ); var dateFns = matchers.filter(function(m) { return m.index > -1; }); dateFns.sort(function(a, b) { return a.index - b.index; }); var matcher = new RegExp(parsedPattern.regexp); var matches = matcher.exec(str); if (matches) { var date = missingValuesDate || module.exports.now(); dateFns.forEach(function(f, i) { f.fn(date, matches[i + 1]); }); return date; } throw new Error( "String '" + str + "' could not be parsed as '" + pattern + "'" ); } function parse(pattern, str, missingValuesDate) { if (!pattern) { throw new Error("pattern must be supplied"); } return extractDateParts(pattern, str, missingValuesDate); } /** * Used for testing - replace this function with a fixed date. */ function now() { return new Date(); } module.exports = asString; module.exports.asString = asString; module.exports.parse = parse; module.exports.now = now; module.exports.ISO8601_FORMAT = "yyyy-MM-ddThh:mm:ss.SSS"; module.exports.ISO8601_WITH_TZ_OFFSET_FORMAT = "yyyy-MM-ddThh:mm:ss.SSSO"; module.exports.DATETIME_FORMAT = "dd MM yyyy hh:mm:ss.SSS"; module.exports.ABSOLUTETIME_FORMAT = "hh:mm:ss.SSS"; node-log4js-6.9.1+~cs8.4.19/package.json000066400000000000000000000017161451773721600174450ustar00rootroot00000000000000{ "name": "date-format", "version": "4.0.14", "description": "Formatting Date objects as strings since 2013", "main": "lib/index.js", "files": [ "lib", "CHANGELOG.md" ], "repository": { "type": "git", "url": "https://github.com/nomiddlename/date-format.git" }, "engines": { "node": ">=4.0" }, "scripts": { "lint": "eslint lib/* test/*", "pretest": "eslint lib/* test/*", "test": "nyc --check-coverage mocha" }, "keywords": [ "date", "format", "string" ], "author": "Gareth Jones ", "license": "MIT", "readmeFilename": "README.md", "gitHead": "bf59015ab6c9e86454b179374f29debbdb403522", "devDependencies": { "eslint": "^8.24.0", "eslint-plugin-mocha": "^10.1.0", "mocha": "^10.0.0", "nyc": "^15.1.0", "should": "^13.2.3" }, "nyc": { "include": [ "lib/**" ], "branches": 100, "lines": 100, "functions": 100 } }