acsi-core 1.2.6 → 1.2.7

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.
@@ -86,6 +86,7 @@ var COLORS = {
86
86
  };
87
87
  var ORGANIZATION_TENANT = "ORGANIZATION_TENANT";
88
88
  var ORGANIZATION_TEAM = "ORGANIZATION_TEAM";
89
+ var TIMEZONE_ID = "TIMEZONE_ID";
89
90
 
90
91
  var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","microsoft_button":"_19ESb","box-field":"_2e9xO","box-input":"_3zXRp","box-text":"_8NJga","box-button-email":"_21FPk","box-signin-container":"_1QERu","box-signin-text":"_2-znH","box-signin-logo":"_1aB2m","box-right":"_3qndF","image-slideshow":"_1aM7m","active":"_Vx1zf","box-right-body":"_JzdCr","box-right-footer":"_19aCA","pr-30":"_2HB5r","width-400":"_4ehXP"};
91
92
 
@@ -1712,6 +1713,7 @@ var apiUpload = axios.create({
1712
1713
  var domain = parts.slice(-2).join('.');
1713
1714
  localStorage.removeItem(ACCESS_TOKEN);
1714
1715
  localStorage.removeItem(ORGANIZATION_TENANT);
1716
+ localStorage.removeItem(TIMEZONE_ID);
1715
1717
  localStorage.removeItem(ORGANIZATION_TEAM);
1716
1718
  Cookies.remove('auth', {
1717
1719
  path: '/',
@@ -3466,8 +3468,23 @@ var CustomSelectOption = function CustomSelectOption(_ref) {
3466
3468
 
3467
3469
  var utcToLocalTime = (function (time, FORMAT) {
3468
3470
  if (time === DATE_MIN_VALUE || time == null) return "";
3471
+ var timezone = localStorage.getItem(TIMEZONE_ID) || "";
3469
3472
  try {
3470
- return moment.utc(time).local().format(FORMAT || "yyyy-MM-DD");
3473
+ if (!timezone) {
3474
+ return moment.utc(time).local().format(FORMAT || "yyyy-MM-DD");
3475
+ }
3476
+ var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3477
+ if (isOffset) {
3478
+ var cleanOffset = timezone.replace(/UTC|GMT/gi, "").trim();
3479
+ var offsetMinutes;
3480
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3481
+ offsetMinutes = parseInt(cleanOffset, 10) * 60;
3482
+ } else {
3483
+ offsetMinutes = cleanOffset;
3484
+ }
3485
+ return moment.utc(time).utcOffset(offsetMinutes).format(FORMAT || "yyyy-MM-DD");
3486
+ }
3487
+ return moment.utc(time).tz(timezone).format(FORMAT || "yyyy-MM-DD");
3471
3488
  } catch (_unused) {
3472
3489
  return "";
3473
3490
  }
@@ -3477,17 +3494,33 @@ var getTimeZoneId = (function () {
3477
3494
  return moment$1.tz.guess();
3478
3495
  });
3479
3496
 
3480
- var timeSpanToLocalMoment = (function (time) {
3497
+ var timeSpanToLocalMoment = (function (time, timezone) {
3481
3498
  if (!time) return null;
3482
- var times = time.split(":");
3483
- if (times.length !== 3) return null;
3484
- var totalSeconds = +times[0] * 60 * 60 + +times[1] * 60 + +times[2];
3485
- var startOfDay = moment.utc().startOf("day");
3486
- var dateTime = startOfDay.add(totalSeconds, "seconds");
3487
- return dateTime.local();
3499
+ if (time.split(":").length !== 3) return null;
3500
+ if (!timezone) {
3501
+ var totalSeconds = +time.split(":")[0] * 60 * 60 + +time.split(":")[1] * 60 + +time.split(":")[2];
3502
+ var startOfDay = moment$1.utc().startOf("day");
3503
+ var _dateTime = startOfDay.add(totalSeconds, "seconds");
3504
+ return _dateTime.local();
3505
+ }
3506
+ var dateTime;
3507
+ var isOffset = /^(UTC|GMT)?[+-]/.test(timezone);
3508
+ if (isOffset) {
3509
+ var cleanOffset = timezone.replace(/UTC|GMT/gi, '').trim();
3510
+ var offsetMinutes;
3511
+ if (/^[+-]?\d+$/.test(cleanOffset)) {
3512
+ offsetMinutes = parseInt(cleanOffset, 10) * 60;
3513
+ } else {
3514
+ offsetMinutes = cleanOffset;
3515
+ }
3516
+ dateTime = moment$1.utc(time, "HH:mm:ss").utcOffset(offsetMinutes);
3517
+ } else {
3518
+ dateTime = moment$1.utc(time, "HH:mm:ss").tz(timezone);
3519
+ }
3520
+ return dateTime;
3488
3521
  });
3489
3522
 
3490
3523
  var historyCore = createBrowserHistory();
3491
3524
 
3492
- 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, 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 };
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 };
3493
3526
  //# sourceMappingURL=index.modern.js.map