@silexpert/core 0.4.209 → 0.4.210

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.
@@ -1,7 +1,7 @@
1
- import { IAccountingTransaction } from '../../types';
1
+ import { IAccountingTransaction, ImportBankAccount } from '../../types';
2
2
  import { Resource } from '../Resource';
3
3
  export declare class Connector extends Resource {
4
4
  test(id: number): Promise<boolean>;
5
- importManually(idBankAccount: number): Promise<IAccountingTransaction[]>;
5
+ importManually(idBankAccount: number, payload: ImportBankAccount): Promise<IAccountingTransaction[]>;
6
6
  }
7
7
  //# sourceMappingURL=Connector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Connector.d.ts","sourceRoot":"","sources":["../../../ts/api/resources/Connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBAAa,SAAU,SAAQ,QAAQ;IACrC,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGlC,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CAGzE"}
1
+ {"version":3,"file":"Connector.d.ts","sourceRoot":"","sources":["../../../ts/api/resources/Connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,qBAAa,SAAU,SAAQ,QAAQ;IACrC,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAGlC,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC;CAGrG"}
@@ -3,8 +3,8 @@ export class Connector extends Resource {
3
3
  test(id) {
4
4
  return this.axios.$post(`/connector/${id}/test`);
5
5
  }
6
- importManually(idBankAccount) {
7
- return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`);
6
+ importManually(idBankAccount, payload) {
7
+ return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`, payload);
8
8
  }
9
9
  }
10
10
  //# sourceMappingURL=Connector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Connector.js","sourceRoot":"","sources":["../../../ts/api/resources/Connector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,OAAO,SAAU,SAAQ,QAAQ;IACrC,IAAI,CAAC,EAAU;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IACD,cAAc,CAAC,aAAqB;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,6BAA6B,aAAa,SAAS,CAAC,CAAC;IAC/E,CAAC;CACF","sourcesContent":["import { IAccountingTransaction } from '../../types';\nimport { Resource } from '../Resource';\n\nexport class Connector extends Resource {\n test(id: number): Promise<boolean> {\n return this.axios.$post(`/connector/${id}/test`);\n }\n importManually(idBankAccount: number): Promise<IAccountingTransaction[]> {\n return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`);\n }\n}"]}
1
+ {"version":3,"file":"Connector.js","sourceRoot":"","sources":["../../../ts/api/resources/Connector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,OAAO,SAAU,SAAQ,QAAQ;IACrC,IAAI,CAAC,EAAU;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IACD,cAAc,CAAC,aAAqB,EAAE,OAA0B;QAC9D,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,6BAA6B,aAAa,SAAS,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;CACF","sourcesContent":["import { IAccountingTransaction, ImportBankAccount } from '../../types';\nimport { Resource } from '../Resource';\n\nexport class Connector extends Resource {\n test(id: number): Promise<boolean> {\n return this.axios.$post(`/connector/${id}/test`);\n }\n importManually(idBankAccount: number, payload: ImportBankAccount): Promise<IAccountingTransaction[]> {\n return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`, payload);\n }\n}"]}
@@ -6,4 +6,5 @@ export * from './decorators';
6
6
  export * from './balanceSheetModule';
7
7
  export * from './siretValidation';
8
8
  export * from './task';
9
+ export * from './social';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
package/es/utils/index.js CHANGED
@@ -6,4 +6,5 @@ export * from './decorators';
6
6
  export * from './balanceSheetModule';
7
7
  export * from './siretValidation';
8
8
  export * from './task';
9
+ export * from './social';
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC","sourcesContent":["export * from './objectUtils';\nexport * from './stringUtils';\nexport * from './brands';\nexport * from './webmail';\nexport * from './decorators';\nexport * from './balanceSheetModule';\nexport * from './siretValidation';\nexport * from './task';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC","sourcesContent":["export * from './objectUtils';\nexport * from './stringUtils';\nexport * from './brands';\nexport * from './webmail';\nexport * from './decorators';\nexport * from './balanceSheetModule';\nexport * from './siretValidation';\nexport * from './task';\nexport * from './social';\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function getBusinessDatesCount(startDate: Date, endDate: Date): number;
2
+ //# sourceMappingURL=social.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social.d.ts","sourceRoot":"","sources":["../../ts/utils/social.ts"],"names":[],"mappings":"AAMA,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,MAAM,CAe5E"}
@@ -0,0 +1,23 @@
1
+ const diffHours = (start, end) => {
2
+ let diff = (start.getTime() - end.getTime()) / 1000;
3
+ diff /= 60 * 60;
4
+ return Math.abs(Math.round(diff));
5
+ };
6
+ export function getBusinessDatesCount(startDate, endDate) {
7
+ const day = startDate;
8
+ let businessDays = 0;
9
+ // eslint-disable-next-line no-unmodified-loop-condition
10
+ while (day <= endDate) {
11
+ if (day.getDay() !== 0 && day.getDay() !== 6) {
12
+ if (diffHours(day, endDate) <= 4) {
13
+ businessDays += 0.5;
14
+ }
15
+ else {
16
+ businessDays += 1;
17
+ }
18
+ }
19
+ day.setDate(day.getDate() + 1);
20
+ }
21
+ return businessDays;
22
+ }
23
+ //# sourceMappingURL=social.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social.js","sourceRoot":"","sources":["../../ts/utils/social.ts"],"names":[],"mappings":"AAAA,MAAM,SAAS,GAAG,CAAC,KAAW,EAAE,GAAS,EAAU,EAAE;IACnD,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IACpD,IAAI,IAAI,EAAE,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,MAAM,UAAU,qBAAqB,CAAC,SAAe,EAAE,OAAa;IAClE,MAAM,GAAG,GAAG,SAAS,CAAC;IACtB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,wDAAwD;IACxD,OAAO,GAAG,IAAI,OAAO,EAAE;QACrB,IAAI,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;YAC5C,IAAI,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE;gBAChC,YAAY,IAAI,GAAG,CAAC;aACrB;iBAAM;gBACL,YAAY,IAAI,CAAC,CAAC;aACnB;SACF;QACD,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;KAChC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["const diffHours = (start: Date, end: Date): number => {\n let diff = (start.getTime() - end.getTime()) / 1000;\n diff /= 60 * 60;\n return Math.abs(Math.round(diff));\n};\n\nexport function getBusinessDatesCount(startDate: Date, endDate: Date): number {\n const day = startDate;\n let businessDays = 0;\n // eslint-disable-next-line no-unmodified-loop-condition\n while (day <= endDate) {\n if (day.getDay() !== 0 && day.getDay() !== 6) {\n if (diffHours(day, endDate) <= 4) {\n businessDays += 0.5;\n } else {\n businessDays += 1;\n }\n }\n day.setDate(day.getDate() + 1);\n }\n return businessDays;\n}"]}
@@ -12,8 +12,8 @@ class Connector extends _Resource.Resource {
12
12
  return this.axios.$post(`/connector/${id}/test`);
13
13
  }
14
14
 
15
- importManually(idBankAccount) {
16
- return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`);
15
+ importManually(idBankAccount, payload) {
16
+ return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`, payload);
17
17
  }
18
18
 
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Connector.js","mappings":";;;;;;;AACA;;AAEM,MAAOA,SAAP,SAAyBC,kBAAzB,CAAiC;EACrCC,IAAI,CAACC,EAAD,EAAW;IACb,OAAO,KAAKC,KAAL,CAAWC,KAAX,CAAiB,cAAcF,EAAE,OAAjC,CAAP;EACD;;EACDG,cAAc,CAACC,aAAD,EAAsB;IAClC,OAAO,KAAKH,KAAL,CAAWC,KAAX,CAAiB,6BAA6BE,aAAa,SAA3D,CAAP;EACD;;AANoC;;QAA1BP,S,GAAAA,S","names":["Connector","Resource","test","id","axios","$post","importManually","idBankAccount"],"sourceRoot":"","sources":["../../../ts/api/resources/Connector.ts"],"sourcesContent":["import { IAccountingTransaction } from '../../types';\nimport { Resource } from '../Resource';\n\nexport class Connector extends Resource {\n test(id: number): Promise<boolean> {\n return this.axios.$post(`/connector/${id}/test`);\n }\n importManually(idBankAccount: number): Promise<IAccountingTransaction[]> {\n return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`);\n }\n}"]}
1
+ {"version":3,"file":"Connector.js","mappings":";;;;;;;AACA;;AAEM,MAAOA,SAAP,SAAyBC,kBAAzB,CAAiC;EACrCC,IAAI,CAACC,EAAD,EAAW;IACb,OAAO,KAAKC,KAAL,CAAWC,KAAX,CAAiB,cAAcF,EAAE,OAAjC,CAAP;EACD;;EACDG,cAAc,CAACC,aAAD,EAAwBC,OAAxB,EAAkD;IAC9D,OAAO,KAAKJ,KAAL,CAAWC,KAAX,CAAiB,6BAA6BE,aAAa,SAA3D,EAAsEC,OAAtE,CAAP;EACD;;AANoC;;QAA1BR,S,GAAAA,S","names":["Connector","Resource","test","id","axios","$post","importManually","idBankAccount","payload"],"sourceRoot":"","sources":["../../../ts/api/resources/Connector.ts"],"sourcesContent":["import { IAccountingTransaction, ImportBankAccount } from '../../types';\nimport { Resource } from '../Resource';\n\nexport class Connector extends Resource {\n test(id: number): Promise<boolean> {\n return this.axios.$post(`/connector/${id}/test`);\n }\n importManually(idBankAccount: number, payload: ImportBankAccount): Promise<IAccountingTransaction[]> {\n return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`, payload);\n }\n}"]}
package/js/utils/index.js CHANGED
@@ -99,4 +99,16 @@ Object.keys(_task).forEach(function (key) {
99
99
  }
100
100
  });
101
101
  });
102
+
103
+ var _social = require("./social");
104
+
105
+ Object.keys(_social).forEach(function (key) {
106
+ if (key === "default" || key === "__esModule") return;
107
+ Object.defineProperty(exports, key, {
108
+ enumerable: true,
109
+ get: function () {
110
+ return _social[key];
111
+ }
112
+ });
113
+ });
102
114
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA","names":[],"sourceRoot":"","sources":["../../ts/utils/index.ts"],"sourcesContent":["export * from './objectUtils';\nexport * from './stringUtils';\nexport * from './brands';\nexport * from './webmail';\nexport * from './decorators';\nexport * from './balanceSheetModule';\nexport * from './siretValidation';\nexport * from './task';\n"]}
1
+ {"version":3,"file":"index.js","mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;;;AACA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA","names":[],"sourceRoot":"","sources":["../../ts/utils/index.ts"],"sourcesContent":["export * from './objectUtils';\nexport * from './stringUtils';\nexport * from './brands';\nexport * from './webmail';\nexport * from './decorators';\nexport * from './balanceSheetModule';\nexport * from './siretValidation';\nexport * from './task';\nexport * from './social';\n"]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getBusinessDatesCount = getBusinessDatesCount;
7
+
8
+ const diffHours = (start, end) => {
9
+ let diff = (start.getTime() - end.getTime()) / 1000;
10
+ diff /= 60 * 60;
11
+ return Math.abs(Math.round(diff));
12
+ };
13
+
14
+ function getBusinessDatesCount(startDate, endDate) {
15
+ const day = startDate;
16
+ let businessDays = 0; // eslint-disable-next-line no-unmodified-loop-condition
17
+
18
+ while (day <= endDate) {
19
+ if (day.getDay() !== 0 && day.getDay() !== 6) {
20
+ if (diffHours(day, endDate) <= 4) {
21
+ businessDays += 0.5;
22
+ } else {
23
+ businessDays += 1;
24
+ }
25
+ }
26
+
27
+ day.setDate(day.getDate() + 1);
28
+ }
29
+
30
+ return businessDays;
31
+ }
32
+ //# sourceMappingURL=social.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social.js","mappings":";;;;;QAMgBA,qB,GAAAA,qB;;AANhB,MAAMC,SAAS,GAAG,CAACC,KAAD,EAAcC,GAAd,KAAmC;EACnD,IAAIC,IAAI,GAAG,CAACF,KAAK,CAACG,OAAN,KAAkBF,GAAG,CAACE,OAAJ,EAAnB,IAAoC,IAA/C;EACAD,IAAI,IAAI,KAAK,EAAb;EACA,OAAOE,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,KAAL,CAAWJ,IAAX,CAAT,CAAP;AACD,CAJD;;AAMM,SAAUJ,qBAAV,CAAgCS,SAAhC,EAAiDC,OAAjD,EAA8D;EAClE,MAAMC,GAAG,GAAGF,SAAZ;EACA,IAAIG,YAAY,GAAG,CAAnB,CAFkE,CAGlE;;EACA,OAAOD,GAAG,IAAID,OAAd,EAAuB;IACrB,IAAIC,GAAG,CAACE,MAAJ,OAAiB,CAAjB,IAAsBF,GAAG,CAACE,MAAJ,OAAiB,CAA3C,EAA8C;MAC5C,IAAIZ,SAAS,CAACU,GAAD,EAAMD,OAAN,CAAT,IAA2B,CAA/B,EAAkC;QAChCE,YAAY,IAAI,GAAhB;MACD,CAFD,MAEO;QACLA,YAAY,IAAI,CAAhB;MACD;IACF;;IACDD,GAAG,CAACG,OAAJ,CAAYH,GAAG,CAACI,OAAJ,KAAgB,CAA5B;EACD;;EACD,OAAOH,YAAP;AACD","names":["getBusinessDatesCount","diffHours","start","end","diff","getTime","Math","abs","round","startDate","endDate","day","businessDays","getDay","setDate","getDate"],"sourceRoot":"","sources":["../../ts/utils/social.ts"],"sourcesContent":["const diffHours = (start: Date, end: Date): number => {\n let diff = (start.getTime() - end.getTime()) / 1000;\n diff /= 60 * 60;\n return Math.abs(Math.round(diff));\n};\n\nexport function getBusinessDatesCount(startDate: Date, endDate: Date): number {\n const day = startDate;\n let businessDays = 0;\n // eslint-disable-next-line no-unmodified-loop-condition\n while (day <= endDate) {\n if (day.getDay() !== 0 && day.getDay() !== 6) {\n if (diffHours(day, endDate) <= 4) {\n businessDays += 0.5;\n } else {\n businessDays += 1;\n }\n }\n day.setDate(day.getDate() + 1);\n }\n return businessDays;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silexpert/core",
3
- "version": "0.4.209",
3
+ "version": "0.4.210",
4
4
  "description": "Silex Core perform HTTP Request and object binding. Silex core helps developers to retrieve and return formatted object",
5
5
  "homepage": "https://gitlab.compta-clementine.fr/dev/silex-api",
6
6
  "main": "js/index.js",
@@ -1,11 +1,11 @@
1
- import { IAccountingTransaction } from '../../types';
1
+ import { IAccountingTransaction, ImportBankAccount } from '../../types';
2
2
  import { Resource } from '../Resource';
3
3
 
4
4
  export class Connector extends Resource {
5
5
  test(id: number): Promise<boolean> {
6
6
  return this.axios.$post(`/connector/${id}/test`);
7
7
  }
8
- importManually(idBankAccount: number): Promise<IAccountingTransaction[]> {
9
- return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`);
8
+ importManually(idBankAccount: number, payload: ImportBankAccount): Promise<IAccountingTransaction[]> {
9
+ return this.axios.$post(`/connectors/bank-accounts/${idBankAccount}/import`, payload);
10
10
  }
11
11
  }
package/ts/utils/index.ts CHANGED
@@ -6,3 +6,4 @@ export * from './decorators';
6
6
  export * from './balanceSheetModule';
7
7
  export * from './siretValidation';
8
8
  export * from './task';
9
+ export * from './social';
@@ -0,0 +1,22 @@
1
+ const diffHours = (start: Date, end: Date): number => {
2
+ let diff = (start.getTime() - end.getTime()) / 1000;
3
+ diff /= 60 * 60;
4
+ return Math.abs(Math.round(diff));
5
+ };
6
+
7
+ export function getBusinessDatesCount(startDate: Date, endDate: Date): number {
8
+ const day = startDate;
9
+ let businessDays = 0;
10
+ // eslint-disable-next-line no-unmodified-loop-condition
11
+ while (day <= endDate) {
12
+ if (day.getDay() !== 0 && day.getDay() !== 6) {
13
+ if (diffHours(day, endDate) <= 4) {
14
+ businessDays += 0.5;
15
+ } else {
16
+ businessDays += 1;
17
+ }
18
+ }
19
+ day.setDate(day.getDate() + 1);
20
+ }
21
+ return businessDays;
22
+ }