mssql-cr-layer 2.0.19 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/index.js +3 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mssql-cr-layer",
3
- "version": "2.0.19",
3
+ "version": "3.0.0",
4
4
  "description": "A MS SQL Server interface layer for common requests",
5
5
  "repository": "andrglo/mssql-cr-layer",
6
6
  "author": {
@@ -22,7 +22,7 @@
22
22
  "devDependencies": {
23
23
  "chai": "^4.3.7",
24
24
  "coveralls": "^3.1.1",
25
- "eslint": "^8.35.0",
25
+ "eslint": "^8.45.0",
26
26
  "eslint-config-google": "^0.14.0",
27
27
  "mocha": "^10.2.0",
28
28
  "nyc": "^15.1.0"
package/src/index.js CHANGED
@@ -241,21 +241,9 @@ MssqlCrLayer.prototype.query = function(statement, params, options) {
241
241
  const param = params[key]
242
242
  if (typeof param === 'object' && !(param instanceof Date)) {
243
243
  input[key] = param && param.value !== void 0 ? param.value : null
244
- // Fix crash when inform a Date value and pass a string
245
- if (
246
- input[key] !== null &&
247
- (param.type === 'date' || param.type === 'datetime') &&
248
- !(input[key] instanceof Date)
249
- ) {
250
- input[key] = new Date(input[key])
251
- }
252
244
  ps.input(key, getType(input[key], param))
253
245
  } else {
254
246
  input[key] = param !== void 0 ? param : null
255
- if (input[key] instanceof Date) {
256
- // Fix mssql precision
257
- input[key] = input[key].toISOString().substring(0, 23) + '000'
258
- }
259
247
  ps.input(key, getType(input[key]))
260
248
  }
261
249
  })
@@ -321,10 +309,10 @@ function getType(value, param) {
321
309
  type = mssql.Date
322
310
  break
323
311
  case 'datetime':
324
- if (param.timezone === 'ignore') {
325
- type = mssql.DateTime2
326
- } else {
312
+ if (param.timezone === true) {
327
313
  type = mssql.DateTimeOffset
314
+ } else {
315
+ type = mssql.DateTime2
328
316
  }
329
317
  break
330
318
  case 'string':