@capillarytech/blaze-ui 4.33.8 → 4.33.9

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.
@@ -309,10 +309,48 @@ _dayjs.default.extend(_utc.default);
309
309
  _dayjs.default.extend(_dayjsTimezoneIanaPlugin.default);
310
310
  _dayjs.default.extend(_dayjsAbbrTimezone.default);
311
311
 
312
- // Verify timezone plugin was properly extended
313
- // This helps catch bundling issues early
314
- if (false) // removed by dead control flow
315
- {}
312
+ // Verify timezone plugin was properly extended immediately after extending
313
+ // This ensures we catch issues early and helps with webpack bundling
314
+ const testInstance = (0, _dayjs.default)();
315
+ if (typeof testInstance.tz !== 'function') {
316
+ console.error('[dayjs-timezone-iana-plugin] CRITICAL: Plugin not properly extended!', 'dayjs().tz type:', typeof testInstance.tz, 'This indicates the plugin extension failed. Check plugin import and order.');
317
+ // Try to re-extend as a fallback (shouldn't be necessary, but helps with bundling issues)
318
+ try {
319
+ _dayjs.default.extend(_dayjsTimezoneIanaPlugin.default);
320
+ const retestInstance = (0, _dayjs.default)();
321
+ if (typeof retestInstance.tz === 'function') {
322
+ console.warn('[dayjs-timezone-iana-plugin] Plugin extension succeeded on retry.');
323
+ }
324
+ } catch (error) {
325
+ console.error('[dayjs-timezone-iana-plugin] Failed to extend plugin:', error);
326
+ }
327
+ }
328
+
329
+ // dayjs-timezone-iana-plugin only provides instance method dayjs().tz(), not static dayjs.tz()
330
+ // Add a static wrapper function to match the API used throughout the codebase
331
+ // Check if dayjs.tz is callable as a function (it might be an object with setDefault)
332
+ const tzIsCallable = typeof _dayjs.default.tz === 'function';
333
+ if (!tzIsCallable) {
334
+ // Preserve existing properties (like setDefault) if they exist
335
+ const existingTz = _dayjs.default.tz;
336
+ const existingSetDefault = existingTz && typeof existingTz.setDefault === 'function' ? existingTz.setDefault : null;
337
+
338
+ // Create a static tz function that wraps the instance method
339
+ // This wrapper ensures dayjs.tz() works even if the instance method is available
340
+ _dayjs.default.tz = function (date, tzName) {
341
+ // Verify instance method is available before using it
342
+ const instance = !date ? (0, _dayjs.default)() : _dayjs.default.isDayjs(date) ? date : (0, _dayjs.default)(date);
343
+ if (typeof instance.tz !== 'function') {
344
+ throw new Error('dayjs().tz() is not available. The timezone plugin may not be properly extended. ' + 'Check that dayjs-timezone-iana-plugin is correctly imported and extended.');
345
+ }
346
+ return instance.tz(tzName);
347
+ };
348
+
349
+ // Restore setDefault if it existed
350
+ if (existingSetDefault) {
351
+ _dayjs.default.tz.setDefault = existingSetDefault;
352
+ }
353
+ }
316
354
 
317
355
  // Core functionality plugins
318
356
  _dayjs.default.extend(_relativeTime.default);