pg-mvc-service 2.0.50 → 2.0.51
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.
|
@@ -79,7 +79,7 @@ class SelectExpression {
|
|
|
79
79
|
*/
|
|
80
80
|
static createDateTime(column, to) {
|
|
81
81
|
const columnInfo = column.model.getColumn(column.name);
|
|
82
|
-
if (['date', 'time', 'timestamp'].includes(columnInfo.type)
|
|
82
|
+
if (['date', 'time', 'timestamp'].includes(columnInfo.type) === false) {
|
|
83
83
|
return '';
|
|
84
84
|
}
|
|
85
85
|
switch (to) {
|
|
@@ -227,8 +227,8 @@ class TableModel {
|
|
|
227
227
|
selectDateAsFormat(column, to, alias) {
|
|
228
228
|
column = typeof column === 'string' ? { name: column, model: this } : column;
|
|
229
229
|
const columnInfo = column.model.getColumn(column.name);
|
|
230
|
-
if (['date', 'time', 'timestamp'].includes(columnInfo.type)
|
|
231
|
-
throw new Error('The first argument of the selectDateAsFormat method must specify a column of type date,
|
|
230
|
+
if (['date', 'time', 'timestamp'].includes(columnInfo.type) === false) {
|
|
231
|
+
throw new Error('The first argument of the selectDateAsFormat method must specify a column of type date, time, or timestamp.');
|
|
232
232
|
}
|
|
233
233
|
this.selectExpressions.push(`${SelectExpression_1.default.createDateTime(column, to)} as "${alias}"`);
|
|
234
234
|
}
|
package/package.json
CHANGED
|
@@ -86,7 +86,7 @@ export default class SelectExpression {
|
|
|
86
86
|
public static createDateTime(column: TColumnInfo, to: 'date' | 'time' | 'datetime') {
|
|
87
87
|
const columnInfo = column.model.getColumn(column.name);
|
|
88
88
|
|
|
89
|
-
if (['date', 'time', 'timestamp'].includes(columnInfo.type)
|
|
89
|
+
if (['date', 'time', 'timestamp'].includes(columnInfo.type) === false) {
|
|
90
90
|
return '';
|
|
91
91
|
}
|
|
92
92
|
|
package/src/models/TableModel.ts
CHANGED
|
@@ -269,8 +269,8 @@ export class TableModel {
|
|
|
269
269
|
column = typeof column === 'string' ? {name: column, model: this} : column;
|
|
270
270
|
const columnInfo = column.model.getColumn(column.name);
|
|
271
271
|
|
|
272
|
-
if (['date', 'time', 'timestamp'].includes(columnInfo.type)
|
|
273
|
-
throw new Error('The first argument of the selectDateAsFormat method must specify a column of type date,
|
|
272
|
+
if (['date', 'time', 'timestamp'].includes(columnInfo.type) === false) {
|
|
273
|
+
throw new Error('The first argument of the selectDateAsFormat method must specify a column of type date, time, or timestamp.');
|
|
274
274
|
}
|
|
275
275
|
this.selectExpressions.push(`${SelectExpression.createDateTime(column, to)} as "${alias}"`);
|
|
276
276
|
}
|