vue-geojson-view-ts 1.3.22 → 1.3.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-geojson-view-ts",
3
- "version": "1.3.22",
3
+ "version": "1.3.23",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -7,14 +7,9 @@
7
7
  <script lang="ts">
8
8
  import { defineComponent } from "vue";
9
9
  import { markerDefault } from "../helpers/imgBase64";
10
- import homeIconUrl from "../assets/home.png";
11
- import endIconUrl from "../assets/end.png";
12
- import trackingIconUrl from "../assets/tracking.png";
13
10
  import origenIconUrl from "../assets/origen.png";
14
11
  import destinoIconUrl from "../assets/destino.png";
15
12
  import llegadaIconUrl from "../assets/llegada.png";
16
- import DestinoIconReferencia from "../assets/address.svg";
17
- import LLegadaSalidaIconReferencia from "../assets/entidad.svg";
18
13
  import * as L from "leaflet";
19
14
  import "leaflet-draw";
20
15
  import "leaflet/dist/leaflet.css";
@@ -948,14 +943,51 @@ export default defineComponent({
948
943
  const formatIsoPreserve = (iso: string): string => {
949
944
  const d = new Date(iso);
950
945
  if (isNaN(d.getTime())) return iso;
951
- const pad = (n: number) => n.toString().padStart(2, "0");
952
- const day = pad(d.getUTCDate());
953
- const month = pad(d.getUTCMonth() + 1);
954
- const year = d.getUTCFullYear();
955
- const hours = pad(d.getUTCHours());
956
- const minutes = pad(d.getUTCMinutes());
957
- const seconds = pad(d.getUTCSeconds());
958
- return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`;
946
+
947
+ // Intentamos usar Intl para formatear en la zona horaria de Bolivia (America/La_Paz)
948
+ try {
949
+ const parts = new Intl.DateTimeFormat("es-BO", {
950
+ timeZone: "America/La_Paz",
951
+ year: "numeric",
952
+ month: "2-digit",
953
+ day: "2-digit",
954
+ hour: "2-digit",
955
+ minute: "2-digit",
956
+ second: "2-digit",
957
+ hour12: false,
958
+ }).formatToParts(d);
959
+
960
+ const getPart = (type: string) =>
961
+ parts.find((p) => p.type === type)?.value || "";
962
+ const day = getPart("day");
963
+ const month = getPart("month");
964
+ const year = getPart("year");
965
+ const hour = getPart("hour");
966
+ const minute = getPart("minute");
967
+ const second = getPart("second");
968
+
969
+ return `${day}/${month}/${year} ${hour}:${minute}:${second}`;
970
+
971
+ // const pad = (n: number) => n.toString().padStart(2, "0");
972
+ // const day = pad(d.getUTCDate());
973
+ // const month = pad(d.getUTCMonth() + 1);
974
+ // const year = d.getUTCFullYear();
975
+ // const hours = pad(d.getUTCHours());
976
+ // const minutes = pad(d.getUTCMinutes());
977
+ // const seconds = pad(d.getUTCSeconds());
978
+ // return `${day}/${month}/${year} ${hours}:${minutes}:${seconds}`;
979
+ } catch (error) {
980
+ // Fallback: aplicar un offset fijo de -4 horas (Bolivia) sobre la fecha UTC recibida.
981
+ const boliviaOffsetMinutes = -4 * 60; // UTC-4
982
+ const localMs = d.getTime() + boliviaOffsetMinutes * 60_000;
983
+ const bd = new Date(localMs);
984
+ const pad = (n: number) => n.toString().padStart(2, "0");
985
+ return `${pad(bd.getUTCDate())}/${pad(
986
+ bd.getUTCMonth() + 1
987
+ )}/${bd.getUTCFullYear()} ${pad(bd.getUTCHours())}:${pad(
988
+ bd.getUTCMinutes()
989
+ )}:${pad(bd.getUTCSeconds())}`;
990
+ }
959
991
  };
960
992
 
961
993
  // Formatear fecha a dd-MM-yyyy hh:mm:ss