@capillarytech/blaze-ui 5.2.2 → 5.2.4
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/.npmrc +2 -0
- package/CapCollapsibleNavbar/index.js +55 -3
- package/CapCollapsibleNavbar/index.js.map +1 -1
- package/CapCondition/index.js +55 -3
- package/CapCondition/index.js.map +1 -1
- package/CapDatePicker/index.js +55 -3
- package/CapDatePicker/index.js.map +1 -1
- package/CapDateTimePicker/README.md +136 -0
- package/CapDateTimePicker/index.d.ts +13 -0
- package/CapDateTimePicker/index.d.ts.map +1 -0
- package/CapDateTimePicker/index.js +166 -106
- package/CapDateTimePicker/index.js.map +1 -1
- package/CapDateTimePicker/messages.d.ts +17 -0
- package/CapDateTimePicker/messages.d.ts.map +1 -0
- package/CapDateTimePicker/types.d.ts +93 -0
- package/CapDateTimePicker/types.d.ts.map +1 -0
- package/CapDateTimeRangePicker/index.js +55 -3
- package/CapDateTimeRangePicker/index.js.map +1 -1
- package/CapEventCalendar/index.js +55 -3
- package/CapEventCalendar/index.js.map +1 -1
- package/CapLanguageProvider/index.js +55 -3
- package/CapLanguageProvider/index.js.map +1 -1
- package/CapLevelGraphRenderer/CapLevelGraphRenderer-test-cases.md +50 -0
- package/CapLevelGraphRenderer/MIGRATION_ANALYSIS.md +138 -0
- package/CapLevelGraphRenderer/README.md +123 -0
- package/CapLevelGraphRenderer/STORYBOOK_ANALYSIS.md +96 -0
- package/CapLevelGraphRenderer/Tooltip.d.ts +31 -0
- package/CapLevelGraphRenderer/Tooltip.d.ts.map +1 -0
- package/CapLevelGraphRenderer/Tooltip_MIGRATION_ANALYSIS.md +120 -0
- package/CapLevelGraphRenderer/index.d.ts +16 -0
- package/CapLevelGraphRenderer/index.d.ts.map +1 -0
- package/CapLevelGraphRenderer/index.js +159 -135
- package/CapLevelGraphRenderer/index.js.map +1 -1
- package/CapLevelGraphRenderer/tests/TEST_COVERAGE.md +119 -0
- package/CapLevelGraphRenderer/types.d.ts +139 -0
- package/CapLevelGraphRenderer/types.d.ts.map +1 -0
- package/CapNotificationDropdown/index.js +55 -3
- package/CapNotificationDropdown/index.js.map +1 -1
- package/CapTimePicker/index.js +55 -3
- package/CapTimePicker/index.js.map +1 -1
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -1
- package/index.js +1053 -4
- package/index.js.map +1 -1
- package/package.json +4 -2
- package/utils/dayjs.d.ts +21 -0
- package/utils/dayjs.d.ts.map +1 -1
package/CapCondition/index.js
CHANGED
|
@@ -8305,7 +8305,7 @@ module.exports = baseSlice;
|
|
|
8305
8305
|
|
|
8306
8306
|
|
|
8307
8307
|
exports.__esModule = true;
|
|
8308
|
-
exports.TIME_UNITS = exports.FORMAT_TOKENS = void 0;
|
|
8308
|
+
exports.TIME_UNITS = exports.FORMAT_TOKENS = exports.DEFAULT_TIMEZONE = void 0;
|
|
8309
8309
|
exports.dayjsToMoment = dayjsToMoment;
|
|
8310
8310
|
exports["default"] = void 0;
|
|
8311
8311
|
exports.hasMomentTimezoneSupport = hasMomentTimezoneSupport;
|
|
@@ -8313,6 +8313,7 @@ exports.isDayjsObject = isDayjsObject;
|
|
|
8313
8313
|
exports.isMomentObject = isMomentObject;
|
|
8314
8314
|
exports.momentToDayjs = momentToDayjs;
|
|
8315
8315
|
exports.normalizeDateValue = normalizeDateValue;
|
|
8316
|
+
exports.toDayjsInTimezone = toDayjsInTimezone;
|
|
8316
8317
|
var _dayjs = _interopRequireDefault(__webpack_require__(87695));
|
|
8317
8318
|
var _advancedFormat = _interopRequireDefault(__webpack_require__(96833));
|
|
8318
8319
|
var _customParseFormat = _interopRequireDefault(__webpack_require__(2825));
|
|
@@ -8424,7 +8425,23 @@ if (!tzIsCallable) {
|
|
|
8424
8425
|
if (_dayjs.default.isDayjs(date)) {
|
|
8425
8426
|
return date.tz(tzName);
|
|
8426
8427
|
}
|
|
8427
|
-
|
|
8428
|
+
// For strings/Dates: interpret the date/time values as being IN the target timezone
|
|
8429
|
+
// (matching moment.tz(string, tz) semantics). dayjs(date).tz(tz) is wrong because
|
|
8430
|
+
// dayjs(date) anchors to the system local timezone, so .tz() converts FROM local TO tz.
|
|
8431
|
+
// Instead: parse as UTC to get raw date/time values, compute the target timezone's offset,
|
|
8432
|
+
// then adjust the UTC timestamp so .tz() produces the intended local time.
|
|
8433
|
+
try {
|
|
8434
|
+
// Validate timezone is a real IANA timezone before applying the offset correction
|
|
8435
|
+
Intl.DateTimeFormat(undefined, {
|
|
8436
|
+
timeZone: tzName
|
|
8437
|
+
});
|
|
8438
|
+
} catch (_unused) {
|
|
8439
|
+
// Invalid timezone — fall back to local time
|
|
8440
|
+
return (0, _dayjs.default)(date);
|
|
8441
|
+
}
|
|
8442
|
+
const asUtc = _dayjs.default.utc(date);
|
|
8443
|
+
const tzOffset = asUtc.tz(tzName).utcOffset(); // target tz offset in minutes
|
|
8444
|
+
return _dayjs.default.utc(asUtc.valueOf() - tzOffset * 60000).tz(tzName);
|
|
8428
8445
|
} catch (error) {
|
|
8429
8446
|
// If timezone is invalid, log error and fall back to local time
|
|
8430
8447
|
logDevError("dayjs.tz: Invalid timezone \"" + tzName + "\"", error);
|
|
@@ -8501,6 +8518,8 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
8501
8518
|
MONTH_FULL: 'MMMM',
|
|
8502
8519
|
YEAR: 'YYYY',
|
|
8503
8520
|
YEAR_SHORT: 'YY',
|
|
8521
|
+
// Cap UI datetime picker format (DD-MM-YYYY | HH:mm)
|
|
8522
|
+
DATE_TIME: 'DD-MM-YYYY | HH:mm',
|
|
8504
8523
|
// Localized formats
|
|
8505
8524
|
DATE_LOCALIZED_SHORT: 'l',
|
|
8506
8525
|
DATETIME_LOCALIZED_SHORT: 'll',
|
|
@@ -8511,6 +8530,7 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
8511
8530
|
DATETIME_LOCALIZED_LONG_TIME: 'LLL',
|
|
8512
8531
|
DATETIME_LOCALIZED_LONG_TIME_WEEKDAY: 'LLLL'
|
|
8513
8532
|
};
|
|
8533
|
+
const DEFAULT_TIMEZONE = exports.DEFAULT_TIMEZONE = 'Asia/Kolkata';
|
|
8514
8534
|
function logDevError(message, error) {
|
|
8515
8535
|
if (false) // removed by dead control flow
|
|
8516
8536
|
{}
|
|
@@ -8591,7 +8611,10 @@ function momentToDayjs(value) {
|
|
|
8591
8611
|
const tz = value.tz();
|
|
8592
8612
|
if (tz) {
|
|
8593
8613
|
// Has a named timezone - preserve it
|
|
8594
|
-
|
|
8614
|
+
// dayjs.utc(date) is required here: dayjs(date) anchors to the system local timezone,
|
|
8615
|
+
// causing .tz() to only re-label without converting hours. dayjs.utc(date) creates a
|
|
8616
|
+
// UTC-mode dayjs, which .tz() correctly converts to the target timezone for display.
|
|
8617
|
+
dayjsObj = _dayjs.default.utc(date).tz(tz);
|
|
8595
8618
|
|
|
8596
8619
|
// WORKAROUND: dayjs-timezone-iana-plugin doesn't persist timezone name in standard way
|
|
8597
8620
|
// Store it manually in $x for round-trip conversion fidelity
|
|
@@ -8644,6 +8667,35 @@ function momentToDayjs(value) {
|
|
|
8644
8667
|
return null;
|
|
8645
8668
|
}
|
|
8646
8669
|
|
|
8670
|
+
/**
|
|
8671
|
+
* Converts any supported date value (Moment, Day.js, string, Date) to a Day.js object
|
|
8672
|
+
* in the specified timezone. This is the recommended single entry point for timezone-safe
|
|
8673
|
+
* date conversion — it handles moment-to-dayjs conversion and timezone application in one step,
|
|
8674
|
+
* avoiding the double-offset bug in dayjs-timezone-iana-plugin.
|
|
8675
|
+
*
|
|
8676
|
+
* @param value - Moment, Day.js, string, Date, or null/undefined
|
|
8677
|
+
* @param timezone - Target IANA timezone (e.g., 'Asia/Kolkata', 'America/New_York')
|
|
8678
|
+
* @returns Day.js object in the target timezone, or null if invalid
|
|
8679
|
+
*
|
|
8680
|
+
* @example
|
|
8681
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'Asia/Kolkata'), 'Asia/Kolkata');
|
|
8682
|
+
* // Returns dayjs representing 2025-04-21 00:00 IST
|
|
8683
|
+
*
|
|
8684
|
+
* @example
|
|
8685
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'UTC'), 'Asia/Kolkata');
|
|
8686
|
+
* // Returns dayjs representing 2025-04-21 05:30 IST
|
|
8687
|
+
*/
|
|
8688
|
+
function toDayjsInTimezone(value, timezone) {
|
|
8689
|
+
const dayjsValue = momentToDayjs(value);
|
|
8690
|
+
if (!dayjsValue) return null;
|
|
8691
|
+
|
|
8692
|
+
// Convert via UTC to avoid the double-offset bug in dayjs-timezone-iana-plugin:
|
|
8693
|
+
// calling .tz() on a dayjs that already has a non-zero utcOffset corrupts the value.
|
|
8694
|
+
// Going through .toDate() → dayjs.utc() gives us a clean UTC-mode dayjs that .tz()
|
|
8695
|
+
// correctly converts to the target timezone.
|
|
8696
|
+
return _dayjs.default.utc(dayjsValue.toDate()).tz(timezone);
|
|
8697
|
+
}
|
|
8698
|
+
|
|
8647
8699
|
/**
|
|
8648
8700
|
* Converts a Day.js object to Moment.js, preserving timezone and locale information.
|
|
8649
8701
|
*
|