Einkaufslisten anzeigen, Datenbankeinbindung
This commit is contained in:
82
express-server/node_modules/postgres-date/index.js
generated
vendored
Normal file
82
express-server/node_modules/postgres-date/index.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
'use strict'
|
||||
|
||||
var DATE_TIME = /(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?/
|
||||
var DATE = /^(\d{1,})-(\d{2})-(\d{2})$/
|
||||
var TIME_ZONE = /([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/
|
||||
var BC = /BC$/
|
||||
var INFINITY = /^-?infinity$/
|
||||
|
||||
module.exports = function parseDate (isoDate) {
|
||||
if (INFINITY.test(isoDate)) {
|
||||
// Capitalize to Infinity before passing to Number
|
||||
return Number(isoDate.replace('i', 'I'))
|
||||
}
|
||||
var matches = DATE_TIME.exec(isoDate)
|
||||
|
||||
if (!matches) {
|
||||
// Force YYYY-MM-DD dates to be parsed as local time
|
||||
return DATE.test(isoDate) ?
|
||||
getDate(isoDate) :
|
||||
null
|
||||
}
|
||||
|
||||
var isBC = BC.test(isoDate)
|
||||
var year = parseInt(matches[1], 10)
|
||||
var isFirstCentury = year > 0 && year < 100
|
||||
year = (isBC ? '-' : '') + year
|
||||
|
||||
var month = parseInt(matches[2], 10) - 1
|
||||
var day = matches[3]
|
||||
var hour = parseInt(matches[4], 10)
|
||||
var minute = parseInt(matches[5], 10)
|
||||
var second = parseInt(matches[6], 10)
|
||||
|
||||
var ms = matches[7]
|
||||
ms = ms ? 1000 * parseFloat(ms) : 0
|
||||
|
||||
var date
|
||||
var offset = timeZoneOffset(isoDate)
|
||||
if (offset != null) {
|
||||
var utc = Date.UTC(year, month, day, hour, minute, second, ms)
|
||||
date = new Date(utc - offset)
|
||||
} else {
|
||||
date = new Date(year, month, day, hour, minute, second, ms)
|
||||
}
|
||||
|
||||
if (isFirstCentury) {
|
||||
date.setUTCFullYear(year)
|
||||
}
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
function getDate (isoDate) {
|
||||
var matches = DATE.exec(isoDate)
|
||||
var year = parseInt(matches[1], 10)
|
||||
var month = parseInt(matches[2], 10) - 1
|
||||
var day = matches[3]
|
||||
// YYYY-MM-DD will be parsed as local time
|
||||
var date = new Date(year, month, day)
|
||||
date.setFullYear(year)
|
||||
return date
|
||||
}
|
||||
|
||||
// match timezones:
|
||||
// Z (UTC)
|
||||
// -05
|
||||
// +06:30
|
||||
function timeZoneOffset (isoDate) {
|
||||
var zone = TIME_ZONE.exec(isoDate.split(' ')[1])
|
||||
if (!zone) return
|
||||
var type = zone[1]
|
||||
|
||||
if (type === 'Z') {
|
||||
return 0
|
||||
}
|
||||
var sign = type === '-' ? -1 : 1
|
||||
var offset = parseInt(zone[2], 10) * 3600 +
|
||||
parseInt(zone[3] || 0, 10) * 60 +
|
||||
parseInt(zone[4] || 0, 10)
|
||||
|
||||
return offset * sign * 1000
|
||||
}
|
21
express-server/node_modules/postgres-date/license
generated
vendored
Normal file
21
express-server/node_modules/postgres-date/license
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Ben Drucker <bvdrucker@gmail.com> (bendrucker.me)
|
||||
|
||||
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.
|
65
express-server/node_modules/postgres-date/package.json
generated
vendored
Normal file
65
express-server/node_modules/postgres-date/package.json
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"_from": "postgres-date@~1.0.0",
|
||||
"_id": "postgres-date@1.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-4tiXAu/bJY/52c7g/pG9BpdSV6g=",
|
||||
"_location": "/postgres-date",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "postgres-date@~1.0.0",
|
||||
"name": "postgres-date",
|
||||
"escapedName": "postgres-date",
|
||||
"rawSpec": "~1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/pg-types"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.3.tgz",
|
||||
"_shasum": "e2d89702efdb258ff9d9cee0fe91bd06975257a8",
|
||||
"_spec": "postgres-date@~1.0.0",
|
||||
"_where": "D:\\5CHITM\\Diplomarbeit\\smart-shopper\\SmartShopper\\express-server\\node_modules\\pg-types",
|
||||
"author": {
|
||||
"name": "Ben Drucker",
|
||||
"email": "bvdrucker@gmail.com",
|
||||
"url": "bendrucker.me"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/bendrucker/postgres-date/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Postgres date column parser",
|
||||
"devDependencies": {
|
||||
"standard": "^4.0.0",
|
||||
"tape": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"readme.md"
|
||||
],
|
||||
"homepage": "https://github.com/bendrucker/postgres-date#readme",
|
||||
"keywords": [
|
||||
"postgres",
|
||||
"date",
|
||||
"parser"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "postgres-date",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/bendrucker/postgres-date.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tape test.js"
|
||||
},
|
||||
"version": "1.0.3"
|
||||
}
|
34
express-server/node_modules/postgres-date/readme.md
generated
vendored
Normal file
34
express-server/node_modules/postgres-date/readme.md
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
# postgres-date [](https://travis-ci.org/bendrucker/postgres-date)
|
||||
|
||||
> Postgres date column parser
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save postgres-date
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var parse = require('postgres-date')
|
||||
parse('2011-01-23 22:15:51Z')
|
||||
// => 2011-01-23T22:15:51.000Z
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
#### `parse(isoDate)` -> `date`
|
||||
|
||||
##### isoDate
|
||||
|
||||
*Required*
|
||||
Type: `string`
|
||||
|
||||
A date string from Postgres.
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Ben Drucker](http://bendrucker.me)
|
Reference in New Issue
Block a user