myio-js-library 0.1.73 → 0.1.74

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.cjs CHANGED
@@ -10887,9 +10887,7 @@ var STRINGS = {
10887
10887
  title: "Demanda",
10888
10888
  period: "Per\xEDodo",
10889
10889
  maximum: "M\xE1xima",
10890
- at: "no dia",
10891
- atTime: "\xE1s",
10892
- timeUnit: "hs",
10890
+ at: "em",
10893
10891
  exportPdf: "Exportar PDF",
10894
10892
  exportCsv: "Exportar CSV",
10895
10893
  fullscreen: "Tela cheia",
@@ -10913,8 +10911,6 @@ var STRINGS = {
10913
10911
  period: "Period",
10914
10912
  maximum: "Maximum",
10915
10913
  at: "on",
10916
- atTime: "at",
10917
- timeUnit: "",
10918
10914
  exportPdf: "Export PDF",
10919
10915
  exportCsv: "Export CSV",
10920
10916
  fullscreen: "Fullscreen",
@@ -11372,9 +11368,7 @@ function formatDateTime(date, locale) {
11372
11368
  return date.toLocaleDateString(locale, {
11373
11369
  day: "2-digit",
11374
11370
  month: "2-digit",
11375
- year: "numeric",
11376
- hour: "2-digit",
11377
- minute: "2-digit"
11371
+ year: "numeric"
11378
11372
  });
11379
11373
  }
11380
11374
  async function fetchTelemetryData(token, deviceId, startDate, endDate, queryParams) {
@@ -11658,10 +11652,10 @@ async function openDemandModal(params) {
11658
11652
  btn.innerHTML = "<span>\u23F3</span> Gerando CSV...";
11659
11653
  try {
11660
11654
  const BOM = "\uFEFF";
11661
- let csv = BOM + "Data/Hora,S\xE9rie,Valor (kW)\n";
11655
+ let csv = BOM + "Data,S\xE9rie,Valor (kW)\n";
11662
11656
  chartData.series.forEach((series) => {
11663
11657
  series.points.forEach((point) => {
11664
- const dateStr2 = formatDateTime(new Date(point.x), locale);
11658
+ const dateStr2 = formatDate2(new Date(point.x), locale);
11665
11659
  const value = point.y.toFixed(2);
11666
11660
  csv += `${dateStr2},${series.label},${value}
11667
11661
  `;
@@ -11733,12 +11727,12 @@ async function openDemandModal(params) {
11733
11727
  currentY += 10;
11734
11728
  const samplePoints = chartData.series[0].points.slice(0, 10);
11735
11729
  doc.setFontSize(10);
11736
- doc.text("Data/Hora", 20, currentY);
11730
+ doc.text("Data", 20, currentY);
11737
11731
  doc.text(params.yAxisLabel || strings.demand, 100, currentY);
11738
11732
  currentY += 7;
11739
11733
  samplePoints.forEach((point) => {
11740
11734
  currentY = ensureRoom(doc, currentY, 10);
11741
- const dateStr = formatDateTime(new Date(point.x), params.locale || "pt-BR");
11735
+ const dateStr = formatDate2(new Date(point.x), params.locale || "pt-BR");
11742
11736
  doc.text(dateStr, 20, currentY);
11743
11737
  doc.text(point.y.toFixed(2), 100, currentY);
11744
11738
  currentY += 7;
@@ -11762,8 +11756,14 @@ async function openDemandModal(params) {
11762
11756
  function initializeDateInputs() {
11763
11757
  const startDate = new Date(currentStartDate);
11764
11758
  const endDate = new Date(currentEndDate);
11765
- dateStartInput.value = startDate.toISOString().split("T")[0];
11766
- dateEndInput.value = endDate.toISOString().split("T")[0];
11759
+ const formatLocalDate = (date) => {
11760
+ const year = date.getFullYear();
11761
+ const month = String(date.getMonth() + 1).padStart(2, "0");
11762
+ const day = String(date.getDate()).padStart(2, "0");
11763
+ return `${year}-${month}-${day}`;
11764
+ };
11765
+ dateStartInput.value = formatLocalDate(startDate);
11766
+ dateEndInput.value = formatLocalDate(endDate);
11767
11767
  }
11768
11768
  async function updatePeriod() {
11769
11769
  periodErrorEl.style.display = "none";
@@ -11851,11 +11851,7 @@ async function openDemandModal(params) {
11851
11851
  month: "2-digit",
11852
11852
  year: "numeric"
11853
11853
  });
11854
- const timeStr = date.toLocaleTimeString(locale, {
11855
- hour: "2-digit",
11856
- minute: "2-digit"
11857
- });
11858
- peakEl.textContent = `${strings.maximum}: ${peak.formattedValue} kW ${peak.key ? `(${peak.key}) ` : ""}${strings.at} ${dateStr} ${strings.atTime} ${timeStr}${strings.timeUnit}`;
11854
+ peakEl.textContent = `${strings.maximum}: ${peak.formattedValue} kW ${peak.key ? `(${peak.key}) ` : ""}${strings.at} ${dateStr}`;
11859
11855
  peakEl.style.display = "block";
11860
11856
  }
11861
11857
  const Chart = window.Chart;
package/dist/index.js CHANGED
@@ -10813,9 +10813,7 @@ var STRINGS = {
10813
10813
  title: "Demanda",
10814
10814
  period: "Per\xEDodo",
10815
10815
  maximum: "M\xE1xima",
10816
- at: "no dia",
10817
- atTime: "\xE1s",
10818
- timeUnit: "hs",
10816
+ at: "em",
10819
10817
  exportPdf: "Exportar PDF",
10820
10818
  exportCsv: "Exportar CSV",
10821
10819
  fullscreen: "Tela cheia",
@@ -10839,8 +10837,6 @@ var STRINGS = {
10839
10837
  period: "Period",
10840
10838
  maximum: "Maximum",
10841
10839
  at: "on",
10842
- atTime: "at",
10843
- timeUnit: "",
10844
10840
  exportPdf: "Export PDF",
10845
10841
  exportCsv: "Export CSV",
10846
10842
  fullscreen: "Fullscreen",
@@ -11298,9 +11294,7 @@ function formatDateTime(date, locale) {
11298
11294
  return date.toLocaleDateString(locale, {
11299
11295
  day: "2-digit",
11300
11296
  month: "2-digit",
11301
- year: "numeric",
11302
- hour: "2-digit",
11303
- minute: "2-digit"
11297
+ year: "numeric"
11304
11298
  });
11305
11299
  }
11306
11300
  async function fetchTelemetryData(token, deviceId, startDate, endDate, queryParams) {
@@ -11584,10 +11578,10 @@ async function openDemandModal(params) {
11584
11578
  btn.innerHTML = "<span>\u23F3</span> Gerando CSV...";
11585
11579
  try {
11586
11580
  const BOM = "\uFEFF";
11587
- let csv = BOM + "Data/Hora,S\xE9rie,Valor (kW)\n";
11581
+ let csv = BOM + "Data,S\xE9rie,Valor (kW)\n";
11588
11582
  chartData.series.forEach((series) => {
11589
11583
  series.points.forEach((point) => {
11590
- const dateStr2 = formatDateTime(new Date(point.x), locale);
11584
+ const dateStr2 = formatDate2(new Date(point.x), locale);
11591
11585
  const value = point.y.toFixed(2);
11592
11586
  csv += `${dateStr2},${series.label},${value}
11593
11587
  `;
@@ -11659,12 +11653,12 @@ async function openDemandModal(params) {
11659
11653
  currentY += 10;
11660
11654
  const samplePoints = chartData.series[0].points.slice(0, 10);
11661
11655
  doc.setFontSize(10);
11662
- doc.text("Data/Hora", 20, currentY);
11656
+ doc.text("Data", 20, currentY);
11663
11657
  doc.text(params.yAxisLabel || strings.demand, 100, currentY);
11664
11658
  currentY += 7;
11665
11659
  samplePoints.forEach((point) => {
11666
11660
  currentY = ensureRoom(doc, currentY, 10);
11667
- const dateStr = formatDateTime(new Date(point.x), params.locale || "pt-BR");
11661
+ const dateStr = formatDate2(new Date(point.x), params.locale || "pt-BR");
11668
11662
  doc.text(dateStr, 20, currentY);
11669
11663
  doc.text(point.y.toFixed(2), 100, currentY);
11670
11664
  currentY += 7;
@@ -11688,8 +11682,14 @@ async function openDemandModal(params) {
11688
11682
  function initializeDateInputs() {
11689
11683
  const startDate = new Date(currentStartDate);
11690
11684
  const endDate = new Date(currentEndDate);
11691
- dateStartInput.value = startDate.toISOString().split("T")[0];
11692
- dateEndInput.value = endDate.toISOString().split("T")[0];
11685
+ const formatLocalDate = (date) => {
11686
+ const year = date.getFullYear();
11687
+ const month = String(date.getMonth() + 1).padStart(2, "0");
11688
+ const day = String(date.getDate()).padStart(2, "0");
11689
+ return `${year}-${month}-${day}`;
11690
+ };
11691
+ dateStartInput.value = formatLocalDate(startDate);
11692
+ dateEndInput.value = formatLocalDate(endDate);
11693
11693
  }
11694
11694
  async function updatePeriod() {
11695
11695
  periodErrorEl.style.display = "none";
@@ -11777,11 +11777,7 @@ async function openDemandModal(params) {
11777
11777
  month: "2-digit",
11778
11778
  year: "numeric"
11779
11779
  });
11780
- const timeStr = date.toLocaleTimeString(locale, {
11781
- hour: "2-digit",
11782
- minute: "2-digit"
11783
- });
11784
- peakEl.textContent = `${strings.maximum}: ${peak.formattedValue} kW ${peak.key ? `(${peak.key}) ` : ""}${strings.at} ${dateStr} ${strings.atTime} ${timeStr}${strings.timeUnit}`;
11780
+ peakEl.textContent = `${strings.maximum}: ${peak.formattedValue} kW ${peak.key ? `(${peak.key}) ` : ""}${strings.at} ${dateStr}`;
11785
11781
  peakEl.style.display = "block";
11786
11782
  }
11787
11783
  const Chart = window.Chart;
@@ -10802,9 +10802,7 @@
10802
10802
  title: "Demanda",
10803
10803
  period: "Per\xEDodo",
10804
10804
  maximum: "M\xE1xima",
10805
- at: "no dia",
10806
- atTime: "\xE1s",
10807
- timeUnit: "hs",
10805
+ at: "em",
10808
10806
  exportPdf: "Exportar PDF",
10809
10807
  exportCsv: "Exportar CSV",
10810
10808
  fullscreen: "Tela cheia",
@@ -10828,8 +10826,6 @@
10828
10826
  period: "Period",
10829
10827
  maximum: "Maximum",
10830
10828
  at: "on",
10831
- atTime: "at",
10832
- timeUnit: "",
10833
10829
  exportPdf: "Export PDF",
10834
10830
  exportCsv: "Export CSV",
10835
10831
  fullscreen: "Fullscreen",
@@ -11287,9 +11283,7 @@
11287
11283
  return date.toLocaleDateString(locale, {
11288
11284
  day: "2-digit",
11289
11285
  month: "2-digit",
11290
- year: "numeric",
11291
- hour: "2-digit",
11292
- minute: "2-digit"
11286
+ year: "numeric"
11293
11287
  });
11294
11288
  }
11295
11289
  async function fetchTelemetryData(token, deviceId, startDate, endDate, queryParams) {
@@ -11573,10 +11567,10 @@
11573
11567
  btn.innerHTML = "<span>\u23F3</span> Gerando CSV...";
11574
11568
  try {
11575
11569
  const BOM = "\uFEFF";
11576
- let csv = BOM + "Data/Hora,S\xE9rie,Valor (kW)\n";
11570
+ let csv = BOM + "Data,S\xE9rie,Valor (kW)\n";
11577
11571
  chartData.series.forEach((series) => {
11578
11572
  series.points.forEach((point) => {
11579
- const dateStr2 = formatDateTime(new Date(point.x), locale);
11573
+ const dateStr2 = formatDate2(new Date(point.x), locale);
11580
11574
  const value = point.y.toFixed(2);
11581
11575
  csv += `${dateStr2},${series.label},${value}
11582
11576
  `;
@@ -11648,12 +11642,12 @@
11648
11642
  currentY += 10;
11649
11643
  const samplePoints = chartData.series[0].points.slice(0, 10);
11650
11644
  doc.setFontSize(10);
11651
- doc.text("Data/Hora", 20, currentY);
11645
+ doc.text("Data", 20, currentY);
11652
11646
  doc.text(params.yAxisLabel || strings.demand, 100, currentY);
11653
11647
  currentY += 7;
11654
11648
  samplePoints.forEach((point) => {
11655
11649
  currentY = ensureRoom(doc, currentY, 10);
11656
- const dateStr = formatDateTime(new Date(point.x), params.locale || "pt-BR");
11650
+ const dateStr = formatDate2(new Date(point.x), params.locale || "pt-BR");
11657
11651
  doc.text(dateStr, 20, currentY);
11658
11652
  doc.text(point.y.toFixed(2), 100, currentY);
11659
11653
  currentY += 7;
@@ -11677,8 +11671,14 @@
11677
11671
  function initializeDateInputs() {
11678
11672
  const startDate = new Date(currentStartDate);
11679
11673
  const endDate = new Date(currentEndDate);
11680
- dateStartInput.value = startDate.toISOString().split("T")[0];
11681
- dateEndInput.value = endDate.toISOString().split("T")[0];
11674
+ const formatLocalDate = (date) => {
11675
+ const year = date.getFullYear();
11676
+ const month = String(date.getMonth() + 1).padStart(2, "0");
11677
+ const day = String(date.getDate()).padStart(2, "0");
11678
+ return `${year}-${month}-${day}`;
11679
+ };
11680
+ dateStartInput.value = formatLocalDate(startDate);
11681
+ dateEndInput.value = formatLocalDate(endDate);
11682
11682
  }
11683
11683
  async function updatePeriod() {
11684
11684
  periodErrorEl.style.display = "none";
@@ -11766,11 +11766,7 @@
11766
11766
  month: "2-digit",
11767
11767
  year: "numeric"
11768
11768
  });
11769
- const timeStr = date.toLocaleTimeString(locale, {
11770
- hour: "2-digit",
11771
- minute: "2-digit"
11772
- });
11773
- peakEl.textContent = `${strings.maximum}: ${peak.formattedValue} kW ${peak.key ? `(${peak.key}) ` : ""}${strings.at} ${dateStr} ${strings.atTime} ${timeStr}${strings.timeUnit}`;
11769
+ peakEl.textContent = `${strings.maximum}: ${peak.formattedValue} kW ${peak.key ? `(${peak.key}) ` : ""}${strings.at} ${dateStr}`;
11774
11770
  peakEl.style.display = "block";
11775
11771
  }
11776
11772
  const Chart = window.Chart;