@outliant/sunrise-utils 1.1.5 → 1.1.6

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.
package/CHANGELOG.md CHANGED
@@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [1.1.6](https://github.com/outliant/sunrise-utils/compare/1.1.5...1.1.6)
8
+
9
+ - chore: change logic for last/next n days filter [`#10`](https://github.com/outliant/sunrise-utils/pull/10)
10
+
7
11
  #### [1.1.5](https://github.com/outliant/sunrise-utils/compare/1.1.4...1.1.5)
8
12
 
13
+ > 19 May 2023
14
+
9
15
  - Task/project banner #866a3c0ug [`#9`](https://github.com/outliant/sunrise-utils/pull/9)
10
16
  - chore: filter checkbox [`fb8d601`](https://github.com/outliant/sunrise-utils/commit/fb8d6015b1ee2092fc69b64d10b0a26b59958574)
11
17
  - chore: update spec [`bcbfd9a`](https://github.com/outliant/sunrise-utils/commit/bcbfd9ad5a21b412c160a85b05d63a43771bc084)
@@ -334,18 +334,11 @@ module.exports.nextNDays = (filter) => {
334
334
  return null;
335
335
  }
336
336
 
337
- const today = moment()
338
- .startOf('day');
339
-
340
- const nextNDays = moment()
341
- .add(filter.value, 'd')
342
- .endOf('day');
343
-
344
337
  return {
345
338
  range: {
346
339
  [filter.type]: {
347
- gt: today.valueOf(),
348
- lt: nextNDays.valueOf()
340
+ lt: `now/d+${filter.value}d`,
341
+ gt: 'now/d'
349
342
  }
350
343
  }
351
344
  };
@@ -356,18 +349,11 @@ module.exports.lastNDays = (filter) => {
356
349
  return null;
357
350
  }
358
351
 
359
- const today = moment()
360
- .startOf('day');
361
-
362
- const lastNDays = moment()
363
- .subtract(filter.value, 'd')
364
- .endOf('day');
365
-
366
352
  return {
367
353
  range: {
368
354
  [filter.type]: {
369
- lt: today.valueOf(),
370
- gt: lastNDays.valueOf()
355
+ gt: `now/d-${filter.value}d`,
356
+ lt: 'now/d'
371
357
  }
372
358
  }
373
359
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@outliant/sunrise-utils",
3
3
  "description": "Helper functions for project Sunrise",
4
- "version": "1.1.5",
4
+ "version": "1.1.6",
5
5
  "license": "ISC",
6
6
  "author": "Outliant",
7
7
  "main": "index.js",