@naturalcycles/abba 1.13.0 → 1.13.1

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/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CommonDB } from '@naturalcycles/db-lib';
2
- import { BaseDBEntity, IsoDateString, Saved } from '@naturalcycles/js-lib';
2
+ import { BaseDBEntity, Saved } from '@naturalcycles/js-lib';
3
3
  export interface AbbaConfig {
4
4
  db: CommonDB;
5
5
  }
@@ -8,8 +8,8 @@ export type BaseExperiment = BaseDBEntity<number> & {
8
8
  status: number;
9
9
  sampling: number;
10
10
  description: string | null;
11
- startDateIncl: IsoDateString;
12
- endDateExcl: IsoDateString;
11
+ startDateIncl: Date;
12
+ endDateExcl: Date;
13
13
  };
14
14
  export type Experiment = BaseExperiment & {
15
15
  rules: SegmentationRule[];
package/dist/util.js CHANGED
@@ -99,6 +99,6 @@ exports.validateSegmentationRule = validateSegmentationRule;
99
99
  */
100
100
  const canGenerateNewAssignments = (experiment) => {
101
101
  return (experiment.status === types_1.AssignmentStatus.Active &&
102
- (0, js_lib_1.localDate)().isBetween(experiment.startDateIncl, experiment.endDateExcl, '[)'));
102
+ (0, js_lib_1.localDate)().isBetween((0, js_lib_1.localDate)(experiment.startDateIncl.toISOString()), (0, js_lib_1.localDate)(experiment.endDateExcl.toISOString()), '[)'));
103
103
  };
104
104
  exports.canGenerateNewAssignments = canGenerateNewAssignments;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/abba",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build": "build",
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CommonDB } from '@naturalcycles/db-lib'
2
- import { BaseDBEntity, IsoDateString, Saved } from '@naturalcycles/js-lib'
2
+ import { BaseDBEntity, Saved } from '@naturalcycles/js-lib'
3
3
 
4
4
  export interface AbbaConfig {
5
5
  db: CommonDB
@@ -18,8 +18,8 @@ export type BaseExperiment = BaseDBEntity<number> & {
18
18
  status: number
19
19
  sampling: number
20
20
  description: string | null
21
- startDateIncl: IsoDateString
22
- endDateExcl: IsoDateString
21
+ startDateIncl: Date
22
+ endDateExcl: Date
23
23
  }
24
24
 
25
25
  export type Experiment = BaseExperiment & {
package/src/util.ts CHANGED
@@ -102,6 +102,10 @@ export const validateSegmentationRule = (
102
102
  export const canGenerateNewAssignments = (experiment: Experiment): boolean => {
103
103
  return (
104
104
  experiment.status === AssignmentStatus.Active &&
105
- localDate().isBetween(experiment.startDateIncl, experiment.endDateExcl, '[)')
105
+ localDate().isBetween(
106
+ localDate(experiment.startDateIncl.toISOString()),
107
+ localDate(experiment.endDateExcl.toISOString()),
108
+ '[)',
109
+ )
106
110
  )
107
111
  }