iamkun / iamkun/dayjs

Day.js Timezone Plugin: .tz() Function Not Working in Capacitor WebView on Android and iOS

Open
#2,747 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Bug**
When using Day.js with the timezone plugin in a Capacitor WebView, an error occurs:
"TypeError: Dv(...).tz is not a function."

**Expected behaviour**
The .tz function should correctly process and convert timezones as expected when using the Day.js timezone plugin. The method should allow manipulating and displaying time in different time zones without throwing an error.

**Information**
Day.js Versions: 1.11.13, 1.11.7
Operating System: Android, iOS
Capacitor Version: 5.7.8
Environment: Capacitor WebView

This issue persists even after updating to the latest Day.js versions and ensuring all dependencies are properly installed. The same code works as expected in a browser but fails within the Capacitor WebView on both Android and iOS. Screenshots have been attached for further reference.

**Screenshots**
The attached screenshots were captured using chrome://inspect/#devices for remote debugging of the WebView:

![image](https://github.com/user-attachments/assets/009a3d2f-5766-45ee-b5aa-2636e3c3abc9)
![image](https://github.com/user-attachments/assets/b3b094b1-485f-496a-9d58-d15f86e2737e)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Day.js timezone plugin's .tz() call in a Capacitor 5.7.8 WebView on Android and iOS, using versions 1.11.13 and 1.11.7, then compare it with the browser behavior. Done means timezone conversion works without the "tz is not a function" error on both mobile platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.