dce-reactkit 4.2.2 → 4.2.4-beta-timestamp.1
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/cjs/index.js +41 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/TabBox.d.ts +1 -0
- package/dist/esm/index.js +41 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/TabBox.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/TabBox.tsx +7 -1
- package/src/helpers/getTimestampFromTimeInfoInET.ts +42 -9
package/dist/esm/index.js
CHANGED
|
@@ -2387,14 +2387,14 @@ const TabBox = (props) => {
|
|
|
2387
2387
|
/*------------------------------------------------------------------------*/
|
|
2388
2388
|
/* -------------------------------- Setup ------------------------------- */
|
|
2389
2389
|
/*------------------------------------------------------------------------*/
|
|
2390
|
-
const { title, children, topRightChildren, noBottomPadding, noBottomMargin, } = props;
|
|
2390
|
+
const { title, children, topRightChildren, noBottomPadding, noBottomMargin, minTitleWidth, } = props;
|
|
2391
2391
|
/*------------------------------------------------------------------------*/
|
|
2392
2392
|
/* ------------------------------- Render ------------------------------- */
|
|
2393
2393
|
/*------------------------------------------------------------------------*/
|
|
2394
2394
|
return (React__default.createElement("div", { className: `TabBox-container ${noBottomMargin ? '' : 'mb-2'}` },
|
|
2395
2395
|
React__default.createElement("style", null, style$7),
|
|
2396
2396
|
React__default.createElement("div", { className: "TabBox-title-container" },
|
|
2397
|
-
React__default.createElement("div", { className: "TabBox-title" }, title),
|
|
2397
|
+
React__default.createElement("div", { className: "TabBox-title", style: { minWidth: minTitleWidth } }, title),
|
|
2398
2398
|
topRightChildren && (React__default.createElement("div", { className: "TabBox-title-right-container" },
|
|
2399
2399
|
React__default.createElement("div", { className: "TabBox-title-right-contents" }, topRightChildren)))),
|
|
2400
2400
|
React__default.createElement("div", { className: `TabBox-box ps-2 pt-2 pe-2 ${noBottomPadding ? '' : 'pb-2'}` },
|
|
@@ -16371,21 +16371,52 @@ const getWordCount = (text) => {
|
|
|
16371
16371
|
* @returns Timestamp in milliseconds since epoch
|
|
16372
16372
|
*/
|
|
16373
16373
|
const getTimestampFromTimeInfoInET = (opts) => {
|
|
16374
|
+
var _a, _b, _c, _d, _e, _f;
|
|
16374
16375
|
// Destructure opts
|
|
16375
16376
|
const { year, month, day, hour, minute, } = opts;
|
|
16376
|
-
// Determine if the date is in DST in Eastern Time
|
|
16377
|
-
const tempDate = new Date(year, month - 1, day);
|
|
16378
|
-
const janOffset = new Date(year, 0, 1).getTimezoneOffset();
|
|
16379
|
-
const isDST = tempDate.getTimezoneOffset() < janOffset;
|
|
16380
|
-
const etOffset = isDST ? '-04:00' : '-05:00';
|
|
16381
16377
|
// Format with leading zeroes
|
|
16382
16378
|
const mm = padZerosLeft(month, 2);
|
|
16383
16379
|
const dd = padZerosLeft(day, 2);
|
|
16384
16380
|
const hh = padZerosLeft(hour, 2);
|
|
16385
16381
|
const min = padZerosLeft(minute, 2);
|
|
16386
|
-
//
|
|
16387
|
-
const
|
|
16388
|
-
const
|
|
16382
|
+
// Use Intl.DateTimeFormat to get the ET offset for the given date
|
|
16383
|
+
const dateForET = new Date(Date.UTC(year, month - 1, day, hour, minute, 0));
|
|
16384
|
+
const options = {
|
|
16385
|
+
timeZone: 'America/New_York',
|
|
16386
|
+
year: 'numeric',
|
|
16387
|
+
month: '2-digit',
|
|
16388
|
+
day: '2-digit',
|
|
16389
|
+
hour: '2-digit',
|
|
16390
|
+
minute: '2-digit',
|
|
16391
|
+
second: '2-digit',
|
|
16392
|
+
hour12: false,
|
|
16393
|
+
};
|
|
16394
|
+
const parts = new Intl.DateTimeFormat('en-US', options).formatToParts(dateForET);
|
|
16395
|
+
const etYear = (_a = parts.find((p) => {
|
|
16396
|
+
return p.type === 'year';
|
|
16397
|
+
})) === null || _a === void 0 ? void 0 : _a.value;
|
|
16398
|
+
const etMonth = (_b = parts.find((p) => {
|
|
16399
|
+
return p.type === 'month';
|
|
16400
|
+
})) === null || _b === void 0 ? void 0 : _b.value;
|
|
16401
|
+
const etDay = (_c = parts.find((p) => {
|
|
16402
|
+
return p.type === 'day';
|
|
16403
|
+
})) === null || _c === void 0 ? void 0 : _c.value;
|
|
16404
|
+
const etHour = (_d = parts.find((p) => {
|
|
16405
|
+
return p.type === 'hour';
|
|
16406
|
+
})) === null || _d === void 0 ? void 0 : _d.value;
|
|
16407
|
+
const etMinute = (_e = parts.find((p) => {
|
|
16408
|
+
return p.type === 'minute';
|
|
16409
|
+
})) === null || _e === void 0 ? void 0 : _e.value;
|
|
16410
|
+
const etSecond = (_f = parts.find((p) => {
|
|
16411
|
+
return p.type === 'second';
|
|
16412
|
+
})) === null || _f === void 0 ? void 0 : _f.value;
|
|
16413
|
+
// Build ET date string and parse as if local, then get UTC timestamp
|
|
16414
|
+
if (!etYear || !etMonth || !etDay || !etHour || !etMinute || !etSecond) {
|
|
16415
|
+
throw new ErrorWithCode('Failed to parse date parts from Intl.DateTimeFormat', ReactKitErrorCode$1.ETTimestampInvalid);
|
|
16416
|
+
}
|
|
16417
|
+
const etDateString = `${etYear}-${etMonth}-${etDay}T${etHour}:${etMinute}:${etSecond}`;
|
|
16418
|
+
const etDate = new Date(etDateString);
|
|
16419
|
+
const timestamp = etDate.getTime();
|
|
16389
16420
|
// Verify that the timestamp is correct
|
|
16390
16421
|
const timeInfoInET = getTimeInfoInET(timestamp);
|
|
16391
16422
|
if (timeInfoInET.year !== year
|