shareneus 1.4.52 → 1.4.54

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.
@@ -454,7 +454,7 @@ class SalesReceiptprintService {
454
454
  shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails(ROPrintData, ROPrintData.CustLaborTotalAfterDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST, ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustPartsTotalAfterDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST, ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts, ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn, tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax, ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, ROPrintData.Adj, null, moreDiscDetails),
455
455
  shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, ROPrintData.isCountersale, ROPrintData.Entity.DecimalsNumber),
456
456
  shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
457
- shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
457
+ shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
458
458
  shared_pdf_service_1.SharedPDFService.GetUnderLine(),
459
459
  shared_pdf_service_1.SharedPDFService.GetInvSignatures(ROPrintData.Entity.CName, ROPrintData.isCountersale),
460
460
  // this.PageBrake(ROPrintData, withPass),
@@ -769,7 +769,7 @@ class HCInvoiceprintService {
769
769
  this.GetNumberInWords(ROPrintData.CustRoundedTotal),
770
770
  this.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, ROPrintData.isCountersale, ROPrintData.Entity.DecimalsNumber),
771
771
  shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
772
- shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
772
+ shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
773
773
  // SharedPDFService.GetUnderLine(),
774
774
  shared_pdf_service_1.SharedPDFService.GetHCInvSignatures(ROPrintData.Entity.CName, ROPrintData.isCountersale),
775
775
  // this.PageBrake(ROPrintData, withPass),
@@ -708,7 +708,7 @@ class InvoiceprintService {
708
708
  return CommonDetails;
709
709
  }
710
710
  static GetBanckdetailswithQRCode(ROPrintData) {
711
- return { columns: [shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
711
+ return { columns: [shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
712
712
  shared_pdf_service_1.SharedPDFService.GetEntityDetails(ROPrintData.Entity)] };
713
713
  }
714
714
  static GetNumberInWords(TotalAmount) {
@@ -901,7 +901,7 @@ class InvoiceLandscapePdfService {
901
901
  // SharedPDFService.GetTaxOnParts(ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
902
902
  // ROPrintData.CustPartSGST, ROPrintData.ShowAccParts, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
903
903
  // ROPrintData.ShowTaxColumn, ROPrintData.From),
904
- shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
904
+ shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
905
905
  {
906
906
  columns: [{ text: '', width: moreDiscDetails ? 153 : 175 }, shared_pdf_service_1.SharedPDFService.GrandTotal(ROPrintData, '0.00', ROPrintData.CustPartsTotalBeforeDisc, totalDisc, totalTax, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, null, ROPrintData.Consolidate, null, moreDiscDetails, ROPrintData.Entity.DecimalsNumber)]
907
907
  }
@@ -708,7 +708,7 @@ class InvoiceLetterheadPdfService {
708
708
  return CommonDetails;
709
709
  }
710
710
  static GetBanckdetailswithQRCode(ROPrintData) {
711
- return { columns: [shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
711
+ return { columns: [shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
712
712
  shared_pdf_service_1.SharedPDFService.GetEntityDetails(ROPrintData.Entity)] };
713
713
  }
714
714
  static GetNumberInWords(TotalAmount) {
@@ -673,7 +673,7 @@ class SharedInvoiceprintService {
673
673
  this.GetNumberInWords(ROPrintData.CustRoundedTotal),
674
674
  shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, ROPrintData.isCountersale, ROPrintData.Entity.DecimalsNumber),
675
675
  shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
676
- shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
676
+ shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
677
677
  shared_pdf_service_1.SharedPDFService.GetUnderLine(),
678
678
  shared_pdf_service_1.SharedPDFService.GetInvSignatures(ROPrintData.Entity.CName, ROPrintData.isCountersale),
679
679
  // this.PageBrake(ROPrintData, withPass),
package/dist/index.d.ts CHANGED
@@ -123,3 +123,4 @@ export { ItemBarCodeLabelPdf } from './inventory/items/item-bar-code-label-pdf';
123
123
  export { GetItemPriceForPriceList } from "./inventory/items/item-price-for-pricelist";
124
124
  export { CalcItemFinalSalePrice } from "./inventory/items/item-price-for-pricelist";
125
125
  export { IsNotNull, IsNull } from "./shared/util";
126
+ export { GetAgeString } from "./shared/util";
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DebitNotePdfService = exports.DCWithoutPricePdfService = exports.DCLandscapeWithoutPricePdfService = exports.DCLandscapePdfService = exports.CustomerBalancesService = exports.SalesByCustomerPDFService = exports.CustWiseSalesDetailsService = exports.CreditNoteTotalsService = exports.CreditNotePdfService = exports.ConsultationPDFService = exports.ConsultationFullPrintService = exports.ConsultationFeeReceiptPrintService = exports.CNPrintService = exports.ChecklistsPDFService = exports.CheckListPrintService = exports.CategoryWiseItemPDFService = exports.SalesReceiptprintService = exports.AppointmentTotalsService = exports.AnalysisPDFService = exports.VenBalanceXlsxFileService = exports.TallySalesImportXlsxFileService = exports.StockXlsxFileService = exports.IssueSparesXlsxFileService = exports.ScheduledDrugXlsxFileService = exports.ScheduledDrugSummaryXlsxFileService = exports.SalesByServiceSummaryXlsxFileService = exports.SummaryXlsxFileService = exports.ServiceAdvisorWisePartXlsxFileService = exports.ServiceAdvisorWiseLaborXlsxFileService = exports.RepairOrdersXlsxFileService = exports.PaymentsMadeXlsxFileService = exports.PaymentReceiveXlsxFileService = exports.OperatorWiseSummaryXlsxFileService = exports.OperatorWiseDetailsXlsxFileService = exports.ManfWiseSalesXlsxFileService = exports.ItemsWiseSalesXlsxFileService = exports.ItemWiseMOSummaryXlsxFileService = exports.ItemWiseMODetailsXlsxFileService = exports.ItemWiseDoctorSaleXlsxFileService = exports.InvoicesWiseXlsxFileService = exports.InsuranceExpireXlsxFileService = exports.GSTR2ExcelService = exports.GSTR1ExcelService = exports.GSTROXlsxFileService = exports.ExpiringDrugsXlsxFileService = exports.SalesByCustomerXlsxFileService = exports.CustWiseSalesXlsxFileService = exports.CustBalanceXlsxFileService = exports.CategoryWiseItemXlsxFileService = exports.AnalysisXlsxFileService = void 0;
4
4
  exports.SharedPDFService = exports.SharedInvoiceprintService = exports.WOPrintService = exports.ScheduledDrugSummaryPDFService = exports.ScheduledDrugPDFService = exports.SalesTotalsService = exports.SaleReceiptPrintService = exports.SalesReceiptpdfService = exports.SalesPrintService = exports.SalesPdfService = exports.SalesByServiceSummaryPDF = exports.ROTotalsService = exports.ROPrintService = exports.RoprintService = exports.RepairOrdersReportsPDFService = exports.ReorderPointPDFService = exports.ReceiptPrintService = exports.PurchaseOrderPDFService = exports.PurchaseOrderTotalsService = exports.PurchaseOrderPrintService = exports.PosReceiptPrintService = exports.POTotalsService = exports.PaymentsReportPDFService = exports.ReceiptPDFService = exports.PackShipPrintService = exports.PackShipPDFService = exports.OperatorWiseSalesSummaryPDF = exports.OperatorWiseSalesDetailsPDF = exports.MaterialOutprintService = exports.MeetingPdfService = exports.ManfWiseSalesService = exports.ItemWiseSalesPDFService = exports.ItemWiseMOSummaryPDF = exports.ItemWiseMODetailsPDF = exports.ItemWiseDoctorSalePDFService = exports.ItemDetaisPdf = exports.IssuePartsprintService = exports.InvoiceTotalsService = exports.InvoiceLandscapePdfService = exports.InvPrintService = exports.InvoiceprintService = exports.InsuranceExpirePDF = exports.ExpiringDrugPDFService = exports.EstPrintService = exports.EquipmentDesignPdf = exports.DeliveryChallanTotalsService = exports.DeliveryChallanPrintService = exports.DeliveryChallanPdfService = exports.DebitNoteTotalsService = exports.DebitNotePrintService = void 0;
5
- exports.IsNull = exports.IsNotNull = exports.CalcItemFinalSalePrice = exports.GetItemPriceForPriceList = exports.ItemBarCodeLabelPdf = exports.NextServiceDatePDFService = exports.NextServiceDateXlsxFileService = exports.ConsultationLetterHeadPDFService = exports.InvoiceLetterheadPdfService = exports.HCInvoiceprintService = exports.InvoicePortraitPrintService = exports.MyDate = exports.TrUtils = exports.VendorDebitNoteTotalsService = exports.VendorDebitNotePrintService = exports.VendorDebitNotePdfService = exports.VendorCreditNoteTotalsService = exports.VendorCreditNotePrintService = exports.VendorCreditNotePDFService = exports.VendorBalancesService = exports.TransferOrderPrintService = exports.TechnicianPrintService = exports.TechnicianpdfService = exports.TaskReportsPDfService = exports.TaskPDfService = exports.PrintSharedService = void 0;
5
+ exports.GetAgeString = exports.IsNull = exports.IsNotNull = exports.CalcItemFinalSalePrice = exports.GetItemPriceForPriceList = exports.ItemBarCodeLabelPdf = exports.NextServiceDatePDFService = exports.NextServiceDateXlsxFileService = exports.ConsultationLetterHeadPDFService = exports.InvoiceLetterheadPdfService = exports.HCInvoiceprintService = exports.InvoicePortraitPrintService = exports.MyDate = exports.TrUtils = exports.VendorDebitNoteTotalsService = exports.VendorDebitNotePrintService = exports.VendorDebitNotePdfService = exports.VendorCreditNoteTotalsService = exports.VendorCreditNotePrintService = exports.VendorCreditNotePDFService = exports.VendorBalancesService = exports.TransferOrderPrintService = exports.TechnicianPrintService = exports.TechnicianpdfService = exports.TaskReportsPDfService = exports.TaskPDfService = exports.PrintSharedService = void 0;
6
6
  var analysis_excel_service_1 = require("./accounting/invoice/reports/excel/analysis-excel.service");
7
7
  Object.defineProperty(exports, "AnalysisXlsxFileService", { enumerable: true, get: function () { return analysis_excel_service_1.AnalysisXlsxFileService; } });
8
8
  var category_wise_item_excel_service_1 = require("./accounting/invoice/reports/excel/category-wise-item-excel.service");
@@ -254,3 +254,5 @@ Object.defineProperty(exports, "CalcItemFinalSalePrice", { enumerable: true, get
254
254
  var util_1 = require("./shared/util");
255
255
  Object.defineProperty(exports, "IsNotNull", { enumerable: true, get: function () { return util_1.IsNotNull; } });
256
256
  Object.defineProperty(exports, "IsNull", { enumerable: true, get: function () { return util_1.IsNull; } });
257
+ var util_2 = require("./shared/util");
258
+ Object.defineProperty(exports, "GetAgeString", { enumerable: true, get: function () { return util_2.GetAgeString; } });
@@ -673,7 +673,7 @@ class IssuePartsprintService {
673
673
  this.GetNumberInWords(ROPrintData.CustRoundedTotal),
674
674
  shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, ROPrintData.isCountersale, ROPrintData.Entity.DecimalsNumber),
675
675
  shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
676
- shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
676
+ shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
677
677
  shared_pdf_service_1.SharedPDFService.GetUnderLine(),
678
678
  shared_pdf_service_1.SharedPDFService.GetInvSignatures(ROPrintData.Entity.CName, ROPrintData.isCountersale),
679
679
  // this.PageBrake(ROPrintData, withPass),
@@ -877,7 +877,7 @@ class DCLandscapePdfService {
877
877
  // SharedPDFService.GetTaxOnParts(ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
878
878
  // ROPrintData.CustPartSGST, ROPrintData.ShowAccParts, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
879
879
  // ROPrintData.ShowTaxColumn, ROPrintData.From),
880
- shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank),
880
+ shared_pdf_service_1.SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
881
881
  {
882
882
  columns: [{ text: '', width: moreDiscDetails ? 140 : 175 }, shared_pdf_service_1.SharedPDFService.GrandTotal(ROPrintData, '0.00', ROPrintData.CustPartsTotalBeforeDisc, totalDisc, totalTax, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, null, ROPrintData.Consolidate, null, moreDiscDetails, ROPrintData.Entity.DecimalsNumber)],
883
883
  }
@@ -140,7 +140,7 @@ export declare class SharedPDFService {
140
140
  };
141
141
  layout: string;
142
142
  };
143
- static GetBankDetials(Bankinfo: any, isPrint: boolean): any;
143
+ static GetBankDetials(Bankinfo: any, isPrint: boolean, UPIPhone: string): any;
144
144
  static GetBankDataTable(data: any, isBank: boolean): any;
145
145
  static LaborTotalTable(ROPrintData: any): {
146
146
  style: string[];
@@ -286,7 +286,7 @@ class SharedPDFService {
286
286
  static GetEntityDetails(Entity) {
287
287
  let SetData = [];
288
288
  if (Entity.PrUPI && !Entity.IsProforma) {
289
- SetData.push({ qr: Entity.UPI, fit: '100', marginLeft: 150 });
289
+ SetData.push({ qr: Entity.UPI, fit: '120', marginLeft: 150 });
290
290
  SetData.push({ text: 'Scan To Pay', fontSize: this.TermsandCond, marginLeft: 151, bold: true, marginTop: 2 });
291
291
  }
292
292
  // SetData.push({ columns: [this.GetEntityTax(Entity)] })
@@ -563,7 +563,7 @@ class SharedPDFService {
563
563
  layout: 'noBorders',
564
564
  };
565
565
  }
566
- static GetBankDetials(Bankinfo, isPrint) {
566
+ static GetBankDetials(Bankinfo, isPrint, UPIPhone) {
567
567
  if (isPrint && !tr_utils_1.TrUtils.IsNull(Bankinfo)) {
568
568
  let AccountFields = [];
569
569
  let BANK = { name: 'BANK', value: Bankinfo.Name };
@@ -571,6 +571,7 @@ class SharedPDFService {
571
571
  let AccHolderName = { name: 'Account Holder Name', value: Bankinfo.ACName };
572
572
  let Branch = { name: 'Branch', value: tr_utils_1.TrUtils.IsNull(Bankinfo.Bran) ? '' : Bankinfo.Bran };
573
573
  let IFSC = { name: 'IFSC NO', value: Bankinfo.IFSC };
574
+ let UPIPh = { name: 'Phone Pay / Google Pay', value: UPIPhone };
574
575
  // let TotalPartsAmount = { name: 'Final Labor Amount', value: this.LabourtotalAmount(ROPrintData.LaborInsTotal) };
575
576
  AccountFields.push(BANK);
576
577
  // if (!TrUtils.IsNull(ROPrintData.OverAllLaborDiscount) && ROPrintData.OverAllLaborDiscount !== 0) {
@@ -579,7 +580,9 @@ class SharedPDFService {
579
580
  // }
580
581
  AccountFields.push(Branch);
581
582
  AccountFields.push(IFSC);
582
- // AccountFields.push(TotalPartsAmount);
583
+ if (!tr_utils_1.TrUtils.IsNull(UPIPhone)) {
584
+ AccountFields.push(UPIPh);
585
+ } // AccountFields.push(TotalPartsAmount);
583
586
  return {
584
587
  style: ['columnheader', 'TotalsStyles'],
585
588
  lineHeight: 1,
@@ -40,6 +40,7 @@ class PrintSharedService {
40
40
  Entity.PrBank = tempEntity.Settings.Acc.PrBnk;
41
41
  Entity.PrUPI = tempEntity.Settings.Acc.PrUPI;
42
42
  Entity.UPI = tempEntity.Settings.Acc.UPI;
43
+ Entity.UPIPhone = tempEntity.Settings.Acc.UPIPhone;
43
44
  }
44
45
  if (tr_utils_1.TrUtils.IsNull(tempEntity.Settings.Common.Tax.GSTIN)) {
45
46
  Entity.GSTIN = '';
@@ -1,3 +1,12 @@
1
1
  export declare function GetNumber(value: any, defaultValue?: number): number;
2
2
  export declare function IsNull(value: unknown): boolean;
3
3
  export declare function IsNotNull(value: unknown): boolean;
4
+ /**
5
+ * Returns age as a human-readable string in years, months, weeks and days.
6
+ * E.g. "10 years, 5 months, 1 week, 2 days".
7
+ * If DOB is in the future or invalid, returns "0 days".
8
+ *
9
+ * @param DOB Date or parsable date-string of birth
10
+ * @param referenceDate Date to calculate age against (default: now)
11
+ */
12
+ export declare function GetAgeString(DOB: Date | string, referenceDate?: Date): string;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetNumber = GetNumber;
4
4
  exports.IsNull = IsNull;
5
5
  exports.IsNotNull = IsNotNull;
6
+ exports.GetAgeString = GetAgeString;
6
7
  function GetNumber(value, defaultValue = 0) {
7
8
  return (value == undefined || value == null || isNaN(value)) ? defaultValue : Number(value);
8
9
  }
@@ -13,3 +14,72 @@ function IsNull(value) {
13
14
  function IsNotNull(value) {
14
15
  return !IsNull(value);
15
16
  }
17
+ /**
18
+ * Returns age as a human-readable string in years, months, weeks and days.
19
+ * E.g. "10 years, 5 months, 1 week, 2 days".
20
+ * If DOB is in the future or invalid, returns "0 days".
21
+ *
22
+ * @param DOB Date or parsable date-string of birth
23
+ * @param referenceDate Date to calculate age against (default: now)
24
+ */
25
+ function GetAgeString(DOB, referenceDate = new Date()) {
26
+ // 1) Parse & validate DOB
27
+ const birthDate = DOB instanceof Date
28
+ ? new Date(DOB.getTime())
29
+ : new Date(DOB);
30
+ if (isNaN(birthDate.getTime())) {
31
+ // invalid date
32
+ return '0 days';
33
+ }
34
+ // 2) Normalize both dates to UTC midnight (avoid DST/timezone issues)
35
+ function toUtcMidnight(d) {
36
+ return new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
37
+ }
38
+ const start = toUtcMidnight(birthDate);
39
+ const end = toUtcMidnight(referenceDate);
40
+ // 3) Prevent negative intervals
41
+ if (start > end) {
42
+ return '0 days';
43
+ }
44
+ // 4) Calculate full years
45
+ let years = end.getUTCFullYear() - start.getUTCFullYear();
46
+ // “Anniversary” = birthday + years
47
+ let anniversary = new Date(Date.UTC(start.getUTCFullYear() + years, start.getUTCMonth(), start.getUTCDate()));
48
+ if (anniversary > end) {
49
+ years--;
50
+ anniversary = new Date(Date.UTC(start.getUTCFullYear() + years, start.getUTCMonth(), start.getUTCDate()));
51
+ }
52
+ // 5) Calculate full months since last anniversary
53
+ let temp = new Date(anniversary);
54
+ let months = 0;
55
+ while (true) {
56
+ const next = new Date(Date.UTC(temp.getUTCFullYear(), temp.getUTCMonth() + 1, temp.getUTCDate()));
57
+ if (next <= end) {
58
+ months++;
59
+ temp = next;
60
+ }
61
+ else {
62
+ break;
63
+ }
64
+ }
65
+ // 6) Calculate remaining days → weeks + days
66
+ const msPerDay = 24 * 60 * 60 * 1000;
67
+ const daysTotal = Math.floor((end.getTime() - temp.getTime()) / msPerDay);
68
+ const weeks = Math.floor(daysTotal / 7);
69
+ const days = daysTotal % 7;
70
+ // 7) Build the output, skipping zero-valued units
71
+ const parts = [];
72
+ if (years)
73
+ parts.push(`${years} year${years > 1 ? 's' : ''}`);
74
+ if (months)
75
+ parts.push(`${months} month${months > 1 ? 's' : ''}`);
76
+ if (weeks)
77
+ parts.push(`${weeks} week${weeks > 1 ? 's' : ''}`);
78
+ if (days)
79
+ parts.push(`${days} day${days > 1 ? 's' : ''}`);
80
+ // 8) Fallback
81
+ if (parts.length === 0) {
82
+ return '0 days';
83
+ }
84
+ return parts.join(', ');
85
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.4.52",
3
+ "version": "1.4.54",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",