acsi-core 1.2.7 → 1.2.9
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.d.ts +2 -1
- package/dist/index.js +40 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +40 -5
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/timeSpanToUtc.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,5 +30,6 @@ import CustomSelectOption from "./components/Selects/CustomSelectOption";
|
|
|
30
30
|
import utcToLocalTime from "./utils/utcToLocalTime";
|
|
31
31
|
import getTimeZoneId from "./utils/getTimeZoneId";
|
|
32
32
|
import timeSpanToLocalMoment from "./utils/timeSpanToLocalMoment";
|
|
33
|
+
import timeSpanToUtc from "./utils/timeSpanToUtc";
|
|
33
34
|
import Cookies from "js-cookie";
|
|
34
|
-
export { setLoading, setLoadingPage, setIsFirstCalendar, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, ORGANIZATION_TEAM, ORGANIZATION_TENANT, TIMEZONE_ID, firstCheckToken, getImageUrl, Login, utcToLocalTime, getTimeZoneId, timeSpanToLocalMoment, getAccessToken, store, historyCore, setAlert, setUser, setTenant, setAddTenant, setTeam, setMenuCollapse, setIsRefetchSidebar, Loading, NotFound, LayoutContext, api, apiUpload, ConfirmDialog, CommonDialog, ToastContainer, toast, Role, Cookies, CustomPagination, useGoogleSignOut, CoreButton, CoreInput, CoreSelect, CoreCheckbox, CoreRadio, CoreError, CoreModal, CoreRange, CoreTextArea, CoreSearch, CoreSelectCompact, CoreInputCompact, CoreTitleInput, CoreTooltip, getErrorMessage, MarkdownLatexRender, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption, GoogleOAuthProvider, useAmplitude, AmplitudeEvent, initializeAmplitude, initSentry };
|
|
35
|
+
export { setLoading, setLoadingPage, setIsFirstCalendar, BASE_URL, OPENSALT_BASE_URL, ACCESS_TOKEN, DATE_TIME_MIN_VALUE, ORGANIZATION_TEAM, ORGANIZATION_TENANT, TIMEZONE_ID, firstCheckToken, getImageUrl, Login, utcToLocalTime, timeSpanToUtc, getTimeZoneId, timeSpanToLocalMoment, getAccessToken, store, historyCore, setAlert, setUser, setTenant, setAddTenant, setTeam, setMenuCollapse, setIsRefetchSidebar, Loading, NotFound, LayoutContext, api, apiUpload, ConfirmDialog, CommonDialog, ToastContainer, toast, Role, Cookies, CustomPagination, useGoogleSignOut, CoreButton, CoreInput, CoreSelect, CoreCheckbox, CoreRadio, CoreError, CoreModal, CoreRange, CoreTextArea, CoreSearch, CoreSelectCompact, CoreInputCompact, CoreTitleInput, CoreTooltip, getErrorMessage, MarkdownLatexRender, CustomSelect, CustomAsyncSelect, CustomCreatable, CustomSelectOption, GoogleOAuthProvider, useAmplitude, AmplitudeEvent, initializeAmplitude, initSentry };
|
package/dist/index.js
CHANGED
|
@@ -3495,16 +3495,17 @@ var getTimeZoneId = (function () {
|
|
|
3495
3495
|
var timeSpanToLocalMoment = (function (time, timezone) {
|
|
3496
3496
|
if (!time) return null;
|
|
3497
3497
|
if (time.split(":").length !== 3) return null;
|
|
3498
|
-
|
|
3498
|
+
var timeZoneUtc = timezone ? timezone : localStorage.getItem(TIMEZONE_ID);
|
|
3499
|
+
if (!timeZoneUtc) {
|
|
3499
3500
|
var totalSeconds = +time.split(":")[0] * 60 * 60 + +time.split(":")[1] * 60 + +time.split(":")[2];
|
|
3500
3501
|
var startOfDay = moment$1.utc().startOf("day");
|
|
3501
3502
|
var _dateTime = startOfDay.add(totalSeconds, "seconds");
|
|
3502
3503
|
return _dateTime.local();
|
|
3503
3504
|
}
|
|
3504
3505
|
var dateTime;
|
|
3505
|
-
var isOffset = /^(UTC|GMT)?[+-]/.test(
|
|
3506
|
+
var isOffset = /^(UTC|GMT)?[+-]/.test(timeZoneUtc);
|
|
3506
3507
|
if (isOffset) {
|
|
3507
|
-
var cleanOffset =
|
|
3508
|
+
var cleanOffset = timeZoneUtc.replace(/UTC|GMT/gi, '').trim();
|
|
3508
3509
|
var offsetMinutes;
|
|
3509
3510
|
if (/^[+-]?\d+$/.test(cleanOffset)) {
|
|
3510
3511
|
offsetMinutes = parseInt(cleanOffset, 10) * 60;
|
|
@@ -3513,11 +3514,45 @@ var timeSpanToLocalMoment = (function (time, timezone) {
|
|
|
3513
3514
|
}
|
|
3514
3515
|
dateTime = moment$1.utc(time, "HH:mm:ss").utcOffset(offsetMinutes);
|
|
3515
3516
|
} else {
|
|
3516
|
-
dateTime = moment$1.utc(time, "HH:mm:ss").tz(
|
|
3517
|
+
dateTime = moment$1.utc(time, "HH:mm:ss").tz(timeZoneUtc);
|
|
3517
3518
|
}
|
|
3518
3519
|
return dateTime;
|
|
3519
3520
|
});
|
|
3520
3521
|
|
|
3522
|
+
var timeSpanToUtc = (function (time, timezone, format) {
|
|
3523
|
+
if (!time) return null;
|
|
3524
|
+
format = format != null ? format : "HH:mm:ss";
|
|
3525
|
+
var timezoneUtc = timezone != null ? timezone : localStorage.getItem(TIMEZONE_ID);
|
|
3526
|
+
var timeStr = "";
|
|
3527
|
+
if (typeof time === "string") {
|
|
3528
|
+
timeStr = time;
|
|
3529
|
+
} else if (time && typeof time === 'object' && 'format' in time) {
|
|
3530
|
+
timeStr = time.format(format);
|
|
3531
|
+
} else {
|
|
3532
|
+
timeStr = moment$1(time).format(format);
|
|
3533
|
+
}
|
|
3534
|
+
try {
|
|
3535
|
+
if (!timezoneUtc) {
|
|
3536
|
+
return moment$1(timeStr, format).utc().format(format);
|
|
3537
|
+
}
|
|
3538
|
+
var isOffset = /^(UTC|GMT)?[+-]/.test(timezoneUtc);
|
|
3539
|
+
if (isOffset) {
|
|
3540
|
+
var cleanOffset = timezoneUtc.replace(/UTC|GMT/gi, "").trim();
|
|
3541
|
+
var offsetMinutes;
|
|
3542
|
+
if (/^[+-]?\d+$/.test(cleanOffset)) {
|
|
3543
|
+
offsetMinutes = parseInt(cleanOffset, 10) * 60;
|
|
3544
|
+
} else {
|
|
3545
|
+
offsetMinutes = cleanOffset;
|
|
3546
|
+
}
|
|
3547
|
+
return moment$1(timeStr, format).utcOffset(offsetMinutes, true).utc().format(format);
|
|
3548
|
+
}
|
|
3549
|
+
return moment$1.tz(timeStr, format, timezoneUtc).utc().format(format);
|
|
3550
|
+
} catch (err) {
|
|
3551
|
+
console.error("Error converting local time to UTC:", err);
|
|
3552
|
+
return null;
|
|
3553
|
+
}
|
|
3554
|
+
});
|
|
3555
|
+
|
|
3521
3556
|
var historyCore = history.createBrowserHistory();
|
|
3522
3557
|
|
|
3523
3558
|
Object.defineProperty(exports, 'GoogleOAuthProvider', {
|
|
@@ -3594,6 +3629,7 @@ exports.setTenant = setTenant;
|
|
|
3594
3629
|
exports.setUser = setUser;
|
|
3595
3630
|
exports.store = store;
|
|
3596
3631
|
exports.timeSpanToLocalMoment = timeSpanToLocalMoment;
|
|
3632
|
+
exports.timeSpanToUtc = timeSpanToUtc;
|
|
3597
3633
|
exports.useAmplitude = useAmplitude;
|
|
3598
3634
|
exports.useGoogleSignOut = useGoogleSignOut;
|
|
3599
3635
|
exports.utcToLocalTime = utcToLocalTime;
|