c2-mongoose 2.1.18 → 2.1.19

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.
@@ -253,11 +253,17 @@ var SearchFlow = /** @class */ (function () {
253
253
  var values = value;
254
254
  if ((0, Utils_1.isNotEmpty)(values[0])) {
255
255
  var momentValue = (0, moment_1.default)(values[0]);
256
- condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $gte: momentValue.toDate().setHours(0, 0, 0) });
256
+ momentValue.hour(0);
257
+ momentValue.minute(0);
258
+ momentValue.second(0);
259
+ condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $gte: momentValue.toDate() });
257
260
  }
258
261
  if ((0, Utils_1.isNotEmpty)(values[1])) {
259
262
  var momentValue = (0, moment_1.default)(values[1]);
260
- condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $lte: momentValue.toDate().setHours(23, 59, 59) });
263
+ momentValue.hour(23);
264
+ momentValue.minute(59);
265
+ momentValue.second(59);
266
+ condition[fieldName] = __assign(__assign({}, condition[fieldName]), { $lte: momentValue.toDate() });
261
267
  }
262
268
  filters.$and.push(condition);
263
269
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-mongoose",
3
- "version": "2.1.18",
3
+ "version": "2.1.19",
4
4
  "description": "Lib to make any search in database mongoose and use as basic crud",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -175,17 +175,23 @@ abstract class SearchFlow {
175
175
  var values = value as any
176
176
  if (isNotEmpty(values[0])) {
177
177
  var momentValue = moment(values[0])
178
+ momentValue.hour(0)
179
+ momentValue.minute(0)
180
+ momentValue.second(0)
178
181
  condition[fieldName] = {
179
182
  ...condition[fieldName],
180
- $gte: momentValue.toDate().setHours(0, 0, 0)
183
+ $gte: momentValue.toDate()
181
184
  }
182
185
  }
183
186
 
184
187
  if (isNotEmpty(values[1])) {
185
188
  var momentValue = moment(values[1])
189
+ momentValue.hour(23)
190
+ momentValue.minute(59)
191
+ momentValue.second(59)
186
192
  condition[fieldName] = {
187
193
  ...condition[fieldName],
188
- $lte: momentValue.toDate().setHours(23, 59, 59)
194
+ $lte: momentValue.toDate()
189
195
  }
190
196
  }
191
197
  filters.$and.push(condition)