acsi-core 1.2.7 → 1.2.8

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.
@@ -3497,16 +3497,17 @@ var getTimeZoneId = (function () {
3497
3497
  var timeSpanToLocalMoment = (function (time, timezone) {
3498
3498
  if (!time) return null;
3499
3499
  if (time.split(":").length !== 3) return null;
3500
- if (!timezone) {
3500
+ var timeZoneUtc = timezone ? timezone : localStorage.getItem(TIMEZONE_ID);
3501
+ if (!timeZoneUtc) {
3501
3502
  var totalSeconds = +time.split(":")[0] * 60 * 60 + +time.split(":")[1] * 60 + +time.split(":")[2];
3502
3503
  var startOfDay = moment$1.utc().startOf("day");
3503
3504
  var _dateTime = startOfDay.add(totalSeconds, "seconds");
3504
3505
  return _dateTime.local();
3505
3506
  }
3506
3507
  var dateTime;
3507
- var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3508
+ var isOffset = /^(UTC|GMT)?[+-]/.test(timeZoneUtc);
3508
3509
  if (isOffset) {
3509
- var cleanOffset = timezone.replace(/UTC|GMT/gi, '').trim();
3510
+ var cleanOffset = timeZoneUtc.replace(/UTC|GMT/gi, '').trim();
3510
3511
  var offsetMinutes;
3511
3512
  if (/^[+-]?\d+$/.test(cleanOffset)) {
3512
3513
  offsetMinutes = parseInt(cleanOffset, 10) * 60;
@@ -3515,12 +3516,46 @@ var timeSpanToLocalMoment = (function (time, timezone) {
3515
3516
  }
3516
3517
  dateTime = moment$1.utc(time, "HH:mm:ss").utcOffset(offsetMinutes);
3517
3518
  } else {
3518
- dateTime = moment$1.utc(time, "HH:mm:ss").tz(timezone);
3519
+ dateTime = moment$1.utc(time, "HH:mm:ss").tz(timeZoneUtc);
3519
3520
  }
3520
3521
  return dateTime;
3521
3522
  });
3522
3523
 
3524
+ var timeSpanToUtc = (function (time, timezone, format) {
3525
+ if (!time) return null;
3526
+ format = format != null ? format : "HH:mm:ss";
3527
+ var timezoneUtc = timezone != null ? timezone : localStorage.getItem(TIMEZONE_ID);
3528
+ var timeStr = "";
3529
+ if (typeof time === "string") {
3530
+ timeStr = time;
3531
+ } else if (time && typeof time === 'object' && 'format' in time) {
3532
+ timeStr = time.format(format);
3533
+ } else {
3534
+ timeStr = moment$1(time).format(format);
3535
+ }
3536
+ try {
3537
+ if (!timezoneUtc) {
3538
+ return moment$1(timeStr, format).utc().format(format);
3539
+ }
3540
+ var isOffset = /^(UTC|GMT)?[+-]/.test(timezoneUtc);
3541
+ if (isOffset) {
3542
+ var cleanOffset = timezoneUtc.replace(/UTC|GMT/gi, "").trim();
3543
+ var offsetMinutes;
3544
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3545
+ offsetMinutes = parseInt(cleanOffset, 10) * 60;
3546
+ } else {
3547
+ offsetMinutes = cleanOffset;
3548
+ }
3549
+ return moment$1(timeStr, format).utcOffset(offsetMinutes, true).utc().format(format);
3550
+ }
3551
+ return moment$1.tz(timeStr, format, timezoneUtc).utc().format(format);
3552
+ } catch (err) {
3553
+ console.error("Error converting local time to UTC:", err);
3554
+ return null;
3555
+ }
3556
+ });
3557
+
3523
3558
  var historyCore = createBrowserHistory();
3524
3559
 
3525
- export { ACCESS_TOKEN, AmplitudeEvent, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreInputCompact, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreSelectCompact, CoreTextArea, CoreTitleInput, CoreTooltip, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login, MarkdownRenderer as MarkdownLatexRender, NotFound, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT, Role, TIMEZONE_ID, api, apiUpload, firstCheckToken, getAccessToken, getErrorMessage, getImageUrl, getTimeZoneId, historyCore, initSentry, initializeAmplitude, setAddTenant, setAlert, setIsFirstCalendar, setIsRefetchSidebar, setLoading, setLoadingPage, setMenuCollapse, setTeam, setTenant, setUser, store, timeSpanToLocalMoment, useAmplitude, useGoogleSignOut, utcToLocalTime };
3560
+ export { ACCESS_TOKEN, AmplitudeEvent, BASE_URL, CommonDialog, ConfirmDialog, CoreButton, CoreInput$1 as CoreCheckbox, CoreError, CoreInput, CoreInputCompact, CoreModal, CoreRadio, CoreRange, CoreSearch, CoreSelect, CoreSelectCompact, CoreTextArea, CoreTitleInput, CoreTooltip, CustomAsyncSelect, CustomCreatable, CustomPagination, CustomSelect, CustomSelectOption, DATE_TIME_MIN_VALUE, LayoutContext, Loading, Login, MarkdownRenderer as MarkdownLatexRender, NotFound, OPENSALT_BASE_URL, ORGANIZATION_TEAM, ORGANIZATION_TENANT, Role, TIMEZONE_ID, api, apiUpload, firstCheckToken, getAccessToken, getErrorMessage, getImageUrl, getTimeZoneId, historyCore, initSentry, initializeAmplitude, setAddTenant, setAlert, setIsFirstCalendar, setIsRefetchSidebar, setLoading, setLoadingPage, setMenuCollapse, setTeam, setTenant, setUser, store, timeSpanToLocalMoment, timeSpanToUtc, useAmplitude, useGoogleSignOut, utcToLocalTime };
3526
3561
  //# sourceMappingURL=index.modern.js.map