disacomp-dateservice 1.0.3 → 1.0.4

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/index.d.ts CHANGED
@@ -12,6 +12,11 @@ interface IDateManipulator {
12
12
  isValidDate(date: string): boolean;
13
13
  getSignDate(): string;
14
14
  getISODateStringFromString(date: string): string;
15
+ getCurrentYear(): number;
16
+ getStartAndEndDateOfMonth(month: number): {
17
+ startDate: string;
18
+ endDate: string;
19
+ };
15
20
  }
16
21
  declare class DateService {
17
22
  private dateManipulator;
@@ -24,6 +29,11 @@ declare class DateService {
24
29
  isValidDate(dateString: string): boolean;
25
30
  getSignDate(): string;
26
31
  getISODateStringFromString(date: string): string;
32
+ getCurrentYear(): number;
33
+ getStartAndEndDateOfMonth(month: number): {
34
+ startDate: string;
35
+ endDate: string;
36
+ };
27
37
  }
28
38
  declare const DisacompDateService: DateService;
29
39
  export default DisacompDateService;
package/dist/index.js CHANGED
@@ -132,6 +132,15 @@ class DateManipulator {
132
132
  const [day, month, year] = date.split("-").map(Number);
133
133
  return `${year}-${this.addCeroAtBegin(month)}-${this.addCeroAtBegin(day)}`;
134
134
  }
135
+ getCurrentYear() {
136
+ return new Date().getUTCFullYear();
137
+ }
138
+ getStartAndEndDateOfMonth(month) {
139
+ const year = this.getCurrentYear();
140
+ const startDate = `01-${this.addCeroAtBegin(month)}-${year}`;
141
+ const endDate = `${DateHelper.getDaysInMonth(month, year)}-${this.addCeroAtBegin(month)}-${year}`;
142
+ return { startDate, endDate };
143
+ }
135
144
  }
136
145
  class DateService {
137
146
  constructor(dateManipulator) {
@@ -161,6 +170,12 @@ class DateService {
161
170
  getISODateStringFromString(date) {
162
171
  return this.dateManipulator.getISODateStringFromString(date);
163
172
  }
173
+ getCurrentYear() {
174
+ return this.dateManipulator.getCurrentYear();
175
+ }
176
+ getStartAndEndDateOfMonth(month) {
177
+ return this.dateManipulator.getStartAndEndDateOfMonth(month);
178
+ }
164
179
  }
165
180
  const DisacompDateService = new DateService(new DateManipulator());
166
181
  exports.default = DisacompDateService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disacomp-dateservice",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Disacomp Date Service",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -44,6 +44,11 @@ interface IDateManipulator {
44
44
  isValidDate(date: string): boolean;
45
45
  getSignDate(): string;
46
46
  getISODateStringFromString(date: string): string;
47
+ getCurrentYear(): number;
48
+ getStartAndEndDateOfMonth(month: number): {
49
+ startDate: string;
50
+ endDate: string;
51
+ };
47
52
  }
48
53
 
49
54
  // Helper class to handle leap years and days in months
@@ -175,6 +180,23 @@ class DateManipulator implements IDateManipulator {
175
180
 
176
181
  return `${year}-${this.addCeroAtBegin(month)}-${this.addCeroAtBegin(day)}`; // Formato ISO YYYY-MM-DD
177
182
  }
183
+
184
+ public getCurrentYear(): number {
185
+ return new Date().getUTCFullYear();
186
+ }
187
+
188
+ public getStartAndEndDateOfMonth(month: number): {
189
+ startDate: string;
190
+ endDate: string;
191
+ } {
192
+ const year = this.getCurrentYear();
193
+ const startDate = `01-${this.addCeroAtBegin(month)}-${year}`;
194
+ const endDate = `${DateHelper.getDaysInMonth(
195
+ month,
196
+ year
197
+ )}-${this.addCeroAtBegin(month)}-${year}`;
198
+ return { startDate, endDate };
199
+ }
178
200
  }
179
201
 
180
202
  // Client code using dependency inversion
@@ -216,6 +238,17 @@ class DateService {
216
238
  public getISODateStringFromString(date: string): string {
217
239
  return this.dateManipulator.getISODateStringFromString(date);
218
240
  }
241
+
242
+ public getCurrentYear(): number {
243
+ return this.dateManipulator.getCurrentYear();
244
+ }
245
+
246
+ public getStartAndEndDateOfMonth(month: number): {
247
+ startDate: string;
248
+ endDate: string;
249
+ } {
250
+ return this.dateManipulator.getStartAndEndDateOfMonth(month);
251
+ }
219
252
  }
220
253
  const DisacompDateService = new DateService(new DateManipulator());
221
254
 
@@ -1 +1 @@
1
- {"program":{"fileNames":["../../../../../usr/local/lib/node_modules/typescript/lib/lib.es5.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2016.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.dom.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.scripthost.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.decorators.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.full.d.ts","./src/index.ts"],"fileInfos":[{"version":"f59215c5f1d886b05395ee7aca73e0ac69ddfad2843aa88530e797879d511bad","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3",{"version":"3dda5344576193a4ae48b8d03f105c86f20b2f2aff0a1d1fd7935f5d68649654","affectsGlobalScope":true},{"version":"35299ae4a62086698444a5aaee27fc7aa377c68cbb90b441c9ace246ffd05c97","affectsGlobalScope":true},{"version":"c5c5565225fce2ede835725a92a28ece149f83542aa4866cfb10290bff7b8996","affectsGlobalScope":true},{"version":"7d2dbc2a0250400af0809b0ad5f84686e84c73526de931f84560e483eb16b03c","affectsGlobalScope":true},{"version":"9d9885c728913c1d16e0d2831b40341d6ad9a0ceecaabc55209b306ad9c736a5","affectsGlobalScope":true},{"version":"17bea081b9c0541f39dd1ae9bc8c78bdd561879a682e60e2f25f688c0ecab248","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"994c234848afc14a2586b6565777f4c0b05dc479ede0a041bfd5becf6dceb586",{"version":"03090d132ef006986522135d56b70b04304c49fb91a0f78c94e2b0ecd92e39ae","signature":"213ee2e4b19d70af1c66ec975e2c27fe3c7f8531d05a628270eb52f821786e00"}],"root":[27],"options":{"composite":true,"module":1,"noImplicitAny":true,"noImplicitThis":true,"outDir":"./dist","removeComments":true,"rootDir":"./src","strict":true,"strictNullChecks":true,"target":4},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[27,24,25,5,6,10,9,2,11,12,13,14,15,16,17,18,3,4,26,22,19,20,21,23,1,8,7],"latestChangedDtsFile":"./dist/index.d.ts"},"version":"5.1.6"}
1
+ {"program":{"fileNames":["../../../../../usr/local/lib/node_modules/typescript/lib/lib.es5.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2016.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.dom.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.scripthost.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.decorators.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2017.full.d.ts","./src/index.ts"],"fileInfos":[{"version":"f59215c5f1d886b05395ee7aca73e0ac69ddfad2843aa88530e797879d511bad","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3",{"version":"3dda5344576193a4ae48b8d03f105c86f20b2f2aff0a1d1fd7935f5d68649654","affectsGlobalScope":true},{"version":"35299ae4a62086698444a5aaee27fc7aa377c68cbb90b441c9ace246ffd05c97","affectsGlobalScope":true},{"version":"c5c5565225fce2ede835725a92a28ece149f83542aa4866cfb10290bff7b8996","affectsGlobalScope":true},{"version":"7d2dbc2a0250400af0809b0ad5f84686e84c73526de931f84560e483eb16b03c","affectsGlobalScope":true},{"version":"9d9885c728913c1d16e0d2831b40341d6ad9a0ceecaabc55209b306ad9c736a5","affectsGlobalScope":true},{"version":"17bea081b9c0541f39dd1ae9bc8c78bdd561879a682e60e2f25f688c0ecab248","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},"994c234848afc14a2586b6565777f4c0b05dc479ede0a041bfd5becf6dceb586",{"version":"40b070664be4ffe10fbe358e656918fda53d386357a2c7a54290ff913cdd6349","signature":"072be224d1e3b2c7d5741be44defd1e64c9cc3b55deb465992ee4f02478fe75e"}],"root":[27],"options":{"composite":true,"module":1,"noImplicitAny":true,"noImplicitThis":true,"outDir":"./dist","removeComments":true,"rootDir":"./src","strict":true,"strictNullChecks":true,"target":4},"referencedMap":[],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[27,24,25,5,6,10,9,2,11,12,13,14,15,16,17,18,3,4,26,22,19,20,21,23,1,8,7],"latestChangedDtsFile":"./dist/index.d.ts"},"version":"5.1.6"}