@capillarytech/blaze-ui 5.1.18 → 5.1.20
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/CapCollapsibleNavbar/index.js +51 -2
- package/CapCollapsibleNavbar/index.js.map +1 -1
- package/CapCondition/index.js +51 -2
- package/CapCondition/index.js.map +1 -1
- package/CapDatePicker/index.js +51 -2
- package/CapDatePicker/index.js.map +1 -1
- package/CapDateTimePicker/index.d.ts.map +1 -1
- package/CapDateTimePicker/index.js +75 -13
- package/CapDateTimePicker/index.js.map +1 -1
- package/CapDateTimePicker/messages.d.ts +8 -0
- package/CapDateTimePicker/messages.d.ts.map +1 -1
- package/CapDateTimePicker/types.d.ts +4 -0
- package/CapDateTimePicker/types.d.ts.map +1 -1
- package/CapDateTimeRangePicker/index.js +51 -2
- package/CapDateTimeRangePicker/index.js.map +1 -1
- package/CapEventCalendar/index.js +51 -2
- package/CapEventCalendar/index.js.map +1 -1
- package/CapLanguageProvider/index.js +51 -2
- package/CapLanguageProvider/index.js.map +1 -1
- package/CapNotificationDropdown/index.js +51 -2
- package/CapNotificationDropdown/index.js.map +1 -1
- package/CapTimePicker/index.js +51 -2
- package/CapTimePicker/index.js.map +1 -1
- package/index.js +75 -13
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/utils/dayjs.d.ts +19 -0
- package/utils/dayjs.d.ts.map +1 -1
|
@@ -4,6 +4,14 @@ declare const _default: {
|
|
|
4
4
|
id: string;
|
|
5
5
|
defaultMessage: string;
|
|
6
6
|
};
|
|
7
|
+
selectLabel: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
};
|
|
11
|
+
todayLabel: {
|
|
12
|
+
id: string;
|
|
13
|
+
defaultMessage: string;
|
|
14
|
+
};
|
|
7
15
|
};
|
|
8
16
|
export default _default;
|
|
9
17
|
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../components/CapDateTimePicker/messages.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,mDAAmD,CAAC
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../components/CapDateTimePicker/messages.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,mDAAmD,CAAC;;;;;;;;;;;;;;;AAEtE,wBAaG"}
|
|
@@ -83,6 +83,10 @@ export interface CapDateTimePickerProps extends Omit<DatePickerProps<Dayjs>, 'va
|
|
|
83
83
|
* @deprecated This prop is discouraged. Consider using custom panel components instead.
|
|
84
84
|
*/
|
|
85
85
|
renderExtraFooter?: () => React.ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Callback when OK button is clicked
|
|
88
|
+
*/
|
|
89
|
+
onOk?: (value: Dayjs | Moment | null | Dayjs[] | Moment[]) => void;
|
|
86
90
|
}
|
|
87
91
|
/** Internal-only: adds react-intl's injected `intl` prop to the public props */
|
|
88
92
|
export type InternalProps = CapDateTimePickerProps & WrappedComponentProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapDateTimePicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,sBACf,SAAQ,IAAI,CACV,eAAe,CAAC,KAAK,CAAC,EACpB,OAAO,GACP,UAAU,GACV,YAAY,GACZ,gBAAgB,GAChB,YAAY,GACZ,mBAAmB,GACnB,WAAW,GACX,mBAAmB,CACtB;IACD;;OAEG;IACH,KAAK,CAAC,EAA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AAK,EAAE,KAAK,KAAK,KAAK,CAAC,SAAS,CAAC;IAEnE;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAEpC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,WAAW,CAAC;IAEjE;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IAE1C;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;CACpE;AAED,gFAAgF;AAChF,MAAM,MAAM,aAAa,GAAG,sBAAsB,GAAG,qBAAqB,CAAC"}
|
|
@@ -3834,6 +3834,7 @@ exports.isDayjsObject = isDayjsObject;
|
|
|
3834
3834
|
exports.isMomentObject = isMomentObject;
|
|
3835
3835
|
exports.momentToDayjs = momentToDayjs;
|
|
3836
3836
|
exports.normalizeDateValue = normalizeDateValue;
|
|
3837
|
+
exports.toDayjsInTimezone = toDayjsInTimezone;
|
|
3837
3838
|
var _dayjs = _interopRequireDefault(__webpack_require__(87695));
|
|
3838
3839
|
var _advancedFormat = _interopRequireDefault(__webpack_require__(96833));
|
|
3839
3840
|
var _customParseFormat = _interopRequireDefault(__webpack_require__(2825));
|
|
@@ -3945,7 +3946,23 @@ if (!tzIsCallable) {
|
|
|
3945
3946
|
if (_dayjs.default.isDayjs(date)) {
|
|
3946
3947
|
return date.tz(tzName);
|
|
3947
3948
|
}
|
|
3948
|
-
|
|
3949
|
+
// For strings/Dates: interpret the date/time values as being IN the target timezone
|
|
3950
|
+
// (matching moment.tz(string, tz) semantics). dayjs(date).tz(tz) is wrong because
|
|
3951
|
+
// dayjs(date) anchors to the system local timezone, so .tz() converts FROM local TO tz.
|
|
3952
|
+
// Instead: parse as UTC to get raw date/time values, compute the target timezone's offset,
|
|
3953
|
+
// then adjust the UTC timestamp so .tz() produces the intended local time.
|
|
3954
|
+
try {
|
|
3955
|
+
// Validate timezone is a real IANA timezone before applying the offset correction
|
|
3956
|
+
Intl.DateTimeFormat(undefined, {
|
|
3957
|
+
timeZone: tzName
|
|
3958
|
+
});
|
|
3959
|
+
} catch (_unused) {
|
|
3960
|
+
// Invalid timezone — fall back to local time
|
|
3961
|
+
return (0, _dayjs.default)(date);
|
|
3962
|
+
}
|
|
3963
|
+
const asUtc = _dayjs.default.utc(date);
|
|
3964
|
+
const tzOffset = asUtc.tz(tzName).utcOffset(); // target tz offset in minutes
|
|
3965
|
+
return _dayjs.default.utc(asUtc.valueOf() - tzOffset * 60000).tz(tzName);
|
|
3949
3966
|
} catch (error) {
|
|
3950
3967
|
// If timezone is invalid, log error and fall back to local time
|
|
3951
3968
|
logDevError("dayjs.tz: Invalid timezone \"" + tzName + "\"", error);
|
|
@@ -4115,7 +4132,10 @@ function momentToDayjs(value) {
|
|
|
4115
4132
|
const tz = value.tz();
|
|
4116
4133
|
if (tz) {
|
|
4117
4134
|
// Has a named timezone - preserve it
|
|
4118
|
-
|
|
4135
|
+
// dayjs.utc(date) is required here: dayjs(date) anchors to the system local timezone,
|
|
4136
|
+
// causing .tz() to only re-label without converting hours. dayjs.utc(date) creates a
|
|
4137
|
+
// UTC-mode dayjs, which .tz() correctly converts to the target timezone for display.
|
|
4138
|
+
dayjsObj = _dayjs.default.utc(date).tz(tz);
|
|
4119
4139
|
|
|
4120
4140
|
// WORKAROUND: dayjs-timezone-iana-plugin doesn't persist timezone name in standard way
|
|
4121
4141
|
// Store it manually in $x for round-trip conversion fidelity
|
|
@@ -4168,6 +4188,35 @@ function momentToDayjs(value) {
|
|
|
4168
4188
|
return null;
|
|
4169
4189
|
}
|
|
4170
4190
|
|
|
4191
|
+
/**
|
|
4192
|
+
* Converts any supported date value (Moment, Day.js, string, Date) to a Day.js object
|
|
4193
|
+
* in the specified timezone. This is the recommended single entry point for timezone-safe
|
|
4194
|
+
* date conversion — it handles moment-to-dayjs conversion and timezone application in one step,
|
|
4195
|
+
* avoiding the double-offset bug in dayjs-timezone-iana-plugin.
|
|
4196
|
+
*
|
|
4197
|
+
* @param value - Moment, Day.js, string, Date, or null/undefined
|
|
4198
|
+
* @param timezone - Target IANA timezone (e.g., 'Asia/Kolkata', 'America/New_York')
|
|
4199
|
+
* @returns Day.js object in the target timezone, or null if invalid
|
|
4200
|
+
*
|
|
4201
|
+
* @example
|
|
4202
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'Asia/Kolkata'), 'Asia/Kolkata');
|
|
4203
|
+
* // Returns dayjs representing 2025-04-21 00:00 IST
|
|
4204
|
+
*
|
|
4205
|
+
* @example
|
|
4206
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'UTC'), 'Asia/Kolkata');
|
|
4207
|
+
* // Returns dayjs representing 2025-04-21 05:30 IST
|
|
4208
|
+
*/
|
|
4209
|
+
function toDayjsInTimezone(value, timezone) {
|
|
4210
|
+
const dayjsValue = momentToDayjs(value);
|
|
4211
|
+
if (!dayjsValue) return null;
|
|
4212
|
+
|
|
4213
|
+
// Convert via UTC to avoid the double-offset bug in dayjs-timezone-iana-plugin:
|
|
4214
|
+
// calling .tz() on a dayjs that already has a non-zero utcOffset corrupts the value.
|
|
4215
|
+
// Going through .toDate() → dayjs.utc() gives us a clean UTC-mode dayjs that .tz()
|
|
4216
|
+
// correctly converts to the target timezone.
|
|
4217
|
+
return _dayjs.default.utc(dayjsValue.toDate()).tz(timezone);
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4171
4220
|
/**
|
|
4172
4221
|
* Converts a Day.js object to Moment.js, preserving timezone and locale information.
|
|
4173
4222
|
*
|