@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
|
@@ -477,7 +477,7 @@ module.exports = isObject;
|
|
|
477
477
|
|
|
478
478
|
|
|
479
479
|
exports.__esModule = true;
|
|
480
|
-
exports.TIME_UNITS = exports.FORMAT_TOKENS = void 0;
|
|
480
|
+
exports.TIME_UNITS = exports.FORMAT_TOKENS = exports.DEFAULT_TIMEZONE = void 0;
|
|
481
481
|
exports.dayjsToMoment = dayjsToMoment;
|
|
482
482
|
exports["default"] = void 0;
|
|
483
483
|
exports.hasMomentTimezoneSupport = hasMomentTimezoneSupport;
|
|
@@ -485,6 +485,7 @@ exports.isDayjsObject = isDayjsObject;
|
|
|
485
485
|
exports.isMomentObject = isMomentObject;
|
|
486
486
|
exports.momentToDayjs = momentToDayjs;
|
|
487
487
|
exports.normalizeDateValue = normalizeDateValue;
|
|
488
|
+
exports.toDayjsInTimezone = toDayjsInTimezone;
|
|
488
489
|
var _dayjs = _interopRequireDefault(__webpack_require__(87695));
|
|
489
490
|
var _advancedFormat = _interopRequireDefault(__webpack_require__(96833));
|
|
490
491
|
var _customParseFormat = _interopRequireDefault(__webpack_require__(2825));
|
|
@@ -596,7 +597,23 @@ if (!tzIsCallable) {
|
|
|
596
597
|
if (_dayjs.default.isDayjs(date)) {
|
|
597
598
|
return date.tz(tzName);
|
|
598
599
|
}
|
|
599
|
-
|
|
600
|
+
// For strings/Dates: interpret the date/time values as being IN the target timezone
|
|
601
|
+
// (matching moment.tz(string, tz) semantics). dayjs(date).tz(tz) is wrong because
|
|
602
|
+
// dayjs(date) anchors to the system local timezone, so .tz() converts FROM local TO tz.
|
|
603
|
+
// Instead: parse as UTC to get raw date/time values, compute the target timezone's offset,
|
|
604
|
+
// then adjust the UTC timestamp so .tz() produces the intended local time.
|
|
605
|
+
try {
|
|
606
|
+
// Validate timezone is a real IANA timezone before applying the offset correction
|
|
607
|
+
Intl.DateTimeFormat(undefined, {
|
|
608
|
+
timeZone: tzName
|
|
609
|
+
});
|
|
610
|
+
} catch (_unused) {
|
|
611
|
+
// Invalid timezone — fall back to local time
|
|
612
|
+
return (0, _dayjs.default)(date);
|
|
613
|
+
}
|
|
614
|
+
const asUtc = _dayjs.default.utc(date);
|
|
615
|
+
const tzOffset = asUtc.tz(tzName).utcOffset(); // target tz offset in minutes
|
|
616
|
+
return _dayjs.default.utc(asUtc.valueOf() - tzOffset * 60000).tz(tzName);
|
|
600
617
|
} catch (error) {
|
|
601
618
|
// If timezone is invalid, log error and fall back to local time
|
|
602
619
|
logDevError("dayjs.tz: Invalid timezone \"" + tzName + "\"", error);
|
|
@@ -673,6 +690,8 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
673
690
|
MONTH_FULL: 'MMMM',
|
|
674
691
|
YEAR: 'YYYY',
|
|
675
692
|
YEAR_SHORT: 'YY',
|
|
693
|
+
// Cap UI datetime picker format (DD-MM-YYYY | HH:mm)
|
|
694
|
+
DATE_TIME: 'DD-MM-YYYY | HH:mm',
|
|
676
695
|
// Localized formats
|
|
677
696
|
DATE_LOCALIZED_SHORT: 'l',
|
|
678
697
|
DATETIME_LOCALIZED_SHORT: 'll',
|
|
@@ -683,6 +702,7 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
683
702
|
DATETIME_LOCALIZED_LONG_TIME: 'LLL',
|
|
684
703
|
DATETIME_LOCALIZED_LONG_TIME_WEEKDAY: 'LLLL'
|
|
685
704
|
};
|
|
705
|
+
const DEFAULT_TIMEZONE = exports.DEFAULT_TIMEZONE = 'Asia/Kolkata';
|
|
686
706
|
function logDevError(message, error) {
|
|
687
707
|
if (false) // removed by dead control flow
|
|
688
708
|
{}
|
|
@@ -763,7 +783,10 @@ function momentToDayjs(value) {
|
|
|
763
783
|
const tz = value.tz();
|
|
764
784
|
if (tz) {
|
|
765
785
|
// Has a named timezone - preserve it
|
|
766
|
-
|
|
786
|
+
// dayjs.utc(date) is required here: dayjs(date) anchors to the system local timezone,
|
|
787
|
+
// causing .tz() to only re-label without converting hours. dayjs.utc(date) creates a
|
|
788
|
+
// UTC-mode dayjs, which .tz() correctly converts to the target timezone for display.
|
|
789
|
+
dayjsObj = _dayjs.default.utc(date).tz(tz);
|
|
767
790
|
|
|
768
791
|
// WORKAROUND: dayjs-timezone-iana-plugin doesn't persist timezone name in standard way
|
|
769
792
|
// Store it manually in $x for round-trip conversion fidelity
|
|
@@ -816,6 +839,35 @@ function momentToDayjs(value) {
|
|
|
816
839
|
return null;
|
|
817
840
|
}
|
|
818
841
|
|
|
842
|
+
/**
|
|
843
|
+
* Converts any supported date value (Moment, Day.js, string, Date) to a Day.js object
|
|
844
|
+
* in the specified timezone. This is the recommended single entry point for timezone-safe
|
|
845
|
+
* date conversion — it handles moment-to-dayjs conversion and timezone application in one step,
|
|
846
|
+
* avoiding the double-offset bug in dayjs-timezone-iana-plugin.
|
|
847
|
+
*
|
|
848
|
+
* @param value - Moment, Day.js, string, Date, or null/undefined
|
|
849
|
+
* @param timezone - Target IANA timezone (e.g., 'Asia/Kolkata', 'America/New_York')
|
|
850
|
+
* @returns Day.js object in the target timezone, or null if invalid
|
|
851
|
+
*
|
|
852
|
+
* @example
|
|
853
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'Asia/Kolkata'), 'Asia/Kolkata');
|
|
854
|
+
* // Returns dayjs representing 2025-04-21 00:00 IST
|
|
855
|
+
*
|
|
856
|
+
* @example
|
|
857
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'UTC'), 'Asia/Kolkata');
|
|
858
|
+
* // Returns dayjs representing 2025-04-21 05:30 IST
|
|
859
|
+
*/
|
|
860
|
+
function toDayjsInTimezone(value, timezone) {
|
|
861
|
+
const dayjsValue = momentToDayjs(value);
|
|
862
|
+
if (!dayjsValue) return null;
|
|
863
|
+
|
|
864
|
+
// Convert via UTC to avoid the double-offset bug in dayjs-timezone-iana-plugin:
|
|
865
|
+
// calling .tz() on a dayjs that already has a non-zero utcOffset corrupts the value.
|
|
866
|
+
// Going through .toDate() → dayjs.utc() gives us a clean UTC-mode dayjs that .tz()
|
|
867
|
+
// correctly converts to the target timezone.
|
|
868
|
+
return _dayjs.default.utc(dayjsValue.toDate()).tz(timezone);
|
|
869
|
+
}
|
|
870
|
+
|
|
819
871
|
/**
|
|
820
872
|
* Converts a Day.js object to Moment.js, preserving timezone and locale information.
|
|
821
873
|
*
|