Cannot get timezone (or any locale) from expo-localization

Please provide the following:

  1. SDK Version:48
  2. Platforms(Android/iOS/web/all):Andriod & iOS, both devices and simulators
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I am trying to get user’s phone timezone with below code but get undefined:

import { getCalendars, getLocales } from "expo-localization";
const { calendar, timeZone, uses24hourClock, firstWeekday } = getCalendars()[0];

All of these: calendar, timeZone, uses24hourClock, firstWeekday are undefined. Maybe I missed something in the document? It does not seem like I need permission from the users to get locales, and I have install the latest SDK48 and “expo-localization”: “~14.1.1”. Tried it on physcial devices too.

In app.json, a plug-in is added (I think when I install the package):
“plugins”: [“expo-localization” ]

Do I need further plugin for getting locales?

Any ideas on how to fix this? Many thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.