law-common 10.63.2-beta.11 → 10.63.2-beta.13

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.
@@ -43,6 +43,20 @@ export declare class VendorEntityModel extends BaseEntityModel<EntityEnum.VENDOR
43
43
  status: VendorStatusEnum;
44
44
  remark: Nullable<string>;
45
45
  static readonly VENDOR_ENTITY_DOCUMENT_TYPES: readonly ["pan", "gst"];
46
+ /**
47
+ * Default number of days added to the Invoice Date to calculate the Due Date,
48
+ * used as a fallback when the Vendor does not have a `dueDays` value configured.
49
+ *
50
+ * @formula
51
+ * DueDate = InvoiceDate + (vendor.dueDays ?? VendorEntityModel.DEFAULT_DUE_DAYS)
52
+ *
53
+ * @example
54
+ * vendor.dueDays = 30 → DueDate = InvoiceDate + 30
55
+ * vendor.dueDays = null → DueDate = InvoiceDate + 7 (this constant)
56
+ *
57
+ * @see VendorEntityModel.dueDays
58
+ */
59
+ static readonly DEFAULT_DUE_DAYS = 7;
46
60
  populateOrganizationTypeModel(organizationTypeEntityModels: OrganizationTypeEntityModel[]): null;
47
61
  getPanNoFourthCharacter(): string;
48
62
  static relationConfigs: RelationConfigs<[], EntityEnum.VENDOR>;
@@ -117,4 +117,18 @@ class VendorEntityModel extends base_entity_model_1.BaseEntityModel {
117
117
  }
118
118
  exports.VendorEntityModel = VendorEntityModel;
119
119
  VendorEntityModel.VENDOR_ENTITY_DOCUMENT_TYPES = ["pan", "gst"];
120
+ /**
121
+ * Default number of days added to the Invoice Date to calculate the Due Date,
122
+ * used as a fallback when the Vendor does not have a `dueDays` value configured.
123
+ *
124
+ * @formula
125
+ * DueDate = InvoiceDate + (vendor.dueDays ?? VendorEntityModel.DEFAULT_DUE_DAYS)
126
+ *
127
+ * @example
128
+ * vendor.dueDays = 30 → DueDate = InvoiceDate + 30
129
+ * vendor.dueDays = null → DueDate = InvoiceDate + 7 (this constant)
130
+ *
131
+ * @see VendorEntityModel.dueDays
132
+ */
133
+ VendorEntityModel.DEFAULT_DUE_DAYS = 7;
120
134
  VendorEntityModel.relationConfigs = [];
@@ -63,4 +63,16 @@ export declare class DateCodeModel {
63
63
  currFY: string;
64
64
  };
65
65
  static getCurrentTimestampCode(): string;
66
+ /**
67
+ * Creates a DateCodeModel instance directly from a JavaScript Date object.
68
+ * Internally formats the date to "yyyyMMdd" and constructs the model.
69
+ *
70
+ * @param date - A valid JavaScript Date object
71
+ * @returns A new DateCodeModel instance representing the given date
72
+ *
73
+ * @example
74
+ * const model = DateCodeModel.fromDateObject(new Date('2025-01-01'));
75
+ * // equivalent to: new DateCodeModel(DateCodeModel.fromDate(new Date('2025-01-01')))
76
+ */
77
+ static fromDateObject(date: Date): DateCodeModel;
66
78
  }
@@ -316,5 +316,19 @@ class DateCodeModel {
316
316
  const minutes = String(nowIST.getUTCMinutes()).padStart(2, "0");
317
317
  return `${year}${month}${day} ${hours}${minutes}`;
318
318
  }
319
+ /**
320
+ * Creates a DateCodeModel instance directly from a JavaScript Date object.
321
+ * Internally formats the date to "yyyyMMdd" and constructs the model.
322
+ *
323
+ * @param date - A valid JavaScript Date object
324
+ * @returns A new DateCodeModel instance representing the given date
325
+ *
326
+ * @example
327
+ * const model = DateCodeModel.fromDateObject(new Date('2025-01-01'));
328
+ * // equivalent to: new DateCodeModel(DateCodeModel.fromDate(new Date('2025-01-01')))
329
+ */
330
+ static fromDateObject(date) {
331
+ return new DateCodeModel(DateCodeModel.fromDate(date));
332
+ }
319
333
  }
320
334
  exports.DateCodeModel = DateCodeModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "10.63.2-beta.11",
3
+ "version": "10.63.2-beta.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [