@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
|
@@ -4059,7 +4059,7 @@ var _default = exports["default"] = SvgFile;
|
|
|
4059
4059
|
|
|
4060
4060
|
|
|
4061
4061
|
exports.__esModule = true;
|
|
4062
|
-
exports.TIME_UNITS = exports.FORMAT_TOKENS = void 0;
|
|
4062
|
+
exports.TIME_UNITS = exports.FORMAT_TOKENS = exports.DEFAULT_TIMEZONE = void 0;
|
|
4063
4063
|
exports.dayjsToMoment = dayjsToMoment;
|
|
4064
4064
|
exports["default"] = void 0;
|
|
4065
4065
|
exports.hasMomentTimezoneSupport = hasMomentTimezoneSupport;
|
|
@@ -4067,6 +4067,7 @@ exports.isDayjsObject = isDayjsObject;
|
|
|
4067
4067
|
exports.isMomentObject = isMomentObject;
|
|
4068
4068
|
exports.momentToDayjs = momentToDayjs;
|
|
4069
4069
|
exports.normalizeDateValue = normalizeDateValue;
|
|
4070
|
+
exports.toDayjsInTimezone = toDayjsInTimezone;
|
|
4070
4071
|
var _dayjs = _interopRequireDefault(__webpack_require__(87695));
|
|
4071
4072
|
var _advancedFormat = _interopRequireDefault(__webpack_require__(96833));
|
|
4072
4073
|
var _customParseFormat = _interopRequireDefault(__webpack_require__(2825));
|
|
@@ -4178,7 +4179,23 @@ if (!tzIsCallable) {
|
|
|
4178
4179
|
if (_dayjs.default.isDayjs(date)) {
|
|
4179
4180
|
return date.tz(tzName);
|
|
4180
4181
|
}
|
|
4181
|
-
|
|
4182
|
+
// For strings/Dates: interpret the date/time values as being IN the target timezone
|
|
4183
|
+
// (matching moment.tz(string, tz) semantics). dayjs(date).tz(tz) is wrong because
|
|
4184
|
+
// dayjs(date) anchors to the system local timezone, so .tz() converts FROM local TO tz.
|
|
4185
|
+
// Instead: parse as UTC to get raw date/time values, compute the target timezone's offset,
|
|
4186
|
+
// then adjust the UTC timestamp so .tz() produces the intended local time.
|
|
4187
|
+
try {
|
|
4188
|
+
// Validate timezone is a real IANA timezone before applying the offset correction
|
|
4189
|
+
Intl.DateTimeFormat(undefined, {
|
|
4190
|
+
timeZone: tzName
|
|
4191
|
+
});
|
|
4192
|
+
} catch (_unused) {
|
|
4193
|
+
// Invalid timezone — fall back to local time
|
|
4194
|
+
return (0, _dayjs.default)(date);
|
|
4195
|
+
}
|
|
4196
|
+
const asUtc = _dayjs.default.utc(date);
|
|
4197
|
+
const tzOffset = asUtc.tz(tzName).utcOffset(); // target tz offset in minutes
|
|
4198
|
+
return _dayjs.default.utc(asUtc.valueOf() - tzOffset * 60000).tz(tzName);
|
|
4182
4199
|
} catch (error) {
|
|
4183
4200
|
// If timezone is invalid, log error and fall back to local time
|
|
4184
4201
|
logDevError("dayjs.tz: Invalid timezone \"" + tzName + "\"", error);
|
|
@@ -4255,6 +4272,8 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
4255
4272
|
MONTH_FULL: 'MMMM',
|
|
4256
4273
|
YEAR: 'YYYY',
|
|
4257
4274
|
YEAR_SHORT: 'YY',
|
|
4275
|
+
// Cap UI datetime picker format (DD-MM-YYYY | HH:mm)
|
|
4276
|
+
DATE_TIME: 'DD-MM-YYYY | HH:mm',
|
|
4258
4277
|
// Localized formats
|
|
4259
4278
|
DATE_LOCALIZED_SHORT: 'l',
|
|
4260
4279
|
DATETIME_LOCALIZED_SHORT: 'll',
|
|
@@ -4265,6 +4284,7 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
4265
4284
|
DATETIME_LOCALIZED_LONG_TIME: 'LLL',
|
|
4266
4285
|
DATETIME_LOCALIZED_LONG_TIME_WEEKDAY: 'LLLL'
|
|
4267
4286
|
};
|
|
4287
|
+
const DEFAULT_TIMEZONE = exports.DEFAULT_TIMEZONE = 'Asia/Kolkata';
|
|
4268
4288
|
function logDevError(message, error) {
|
|
4269
4289
|
if (false) // removed by dead control flow
|
|
4270
4290
|
{}
|
|
@@ -4345,7 +4365,10 @@ function momentToDayjs(value) {
|
|
|
4345
4365
|
const tz = value.tz();
|
|
4346
4366
|
if (tz) {
|
|
4347
4367
|
// Has a named timezone - preserve it
|
|
4348
|
-
|
|
4368
|
+
// dayjs.utc(date) is required here: dayjs(date) anchors to the system local timezone,
|
|
4369
|
+
// causing .tz() to only re-label without converting hours. dayjs.utc(date) creates a
|
|
4370
|
+
// UTC-mode dayjs, which .tz() correctly converts to the target timezone for display.
|
|
4371
|
+
dayjsObj = _dayjs.default.utc(date).tz(tz);
|
|
4349
4372
|
|
|
4350
4373
|
// WORKAROUND: dayjs-timezone-iana-plugin doesn't persist timezone name in standard way
|
|
4351
4374
|
// Store it manually in $x for round-trip conversion fidelity
|
|
@@ -4398,6 +4421,35 @@ function momentToDayjs(value) {
|
|
|
4398
4421
|
return null;
|
|
4399
4422
|
}
|
|
4400
4423
|
|
|
4424
|
+
/**
|
|
4425
|
+
* Converts any supported date value (Moment, Day.js, string, Date) to a Day.js object
|
|
4426
|
+
* in the specified timezone. This is the recommended single entry point for timezone-safe
|
|
4427
|
+
* date conversion — it handles moment-to-dayjs conversion and timezone application in one step,
|
|
4428
|
+
* avoiding the double-offset bug in dayjs-timezone-iana-plugin.
|
|
4429
|
+
*
|
|
4430
|
+
* @param value - Moment, Day.js, string, Date, or null/undefined
|
|
4431
|
+
* @param timezone - Target IANA timezone (e.g., 'Asia/Kolkata', 'America/New_York')
|
|
4432
|
+
* @returns Day.js object in the target timezone, or null if invalid
|
|
4433
|
+
*
|
|
4434
|
+
* @example
|
|
4435
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'Asia/Kolkata'), 'Asia/Kolkata');
|
|
4436
|
+
* // Returns dayjs representing 2025-04-21 00:00 IST
|
|
4437
|
+
*
|
|
4438
|
+
* @example
|
|
4439
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'UTC'), 'Asia/Kolkata');
|
|
4440
|
+
* // Returns dayjs representing 2025-04-21 05:30 IST
|
|
4441
|
+
*/
|
|
4442
|
+
function toDayjsInTimezone(value, timezone) {
|
|
4443
|
+
const dayjsValue = momentToDayjs(value);
|
|
4444
|
+
if (!dayjsValue) return null;
|
|
4445
|
+
|
|
4446
|
+
// Convert via UTC to avoid the double-offset bug in dayjs-timezone-iana-plugin:
|
|
4447
|
+
// calling .tz() on a dayjs that already has a non-zero utcOffset corrupts the value.
|
|
4448
|
+
// Going through .toDate() → dayjs.utc() gives us a clean UTC-mode dayjs that .tz()
|
|
4449
|
+
// correctly converts to the target timezone.
|
|
4450
|
+
return _dayjs.default.utc(dayjsValue.toDate()).tz(timezone);
|
|
4451
|
+
}
|
|
4452
|
+
|
|
4401
4453
|
/**
|
|
4402
4454
|
* Converts a Day.js object to Moment.js, preserving timezone and locale information.
|
|
4403
4455
|
*
|