Socket
Socket
Sign inDemoInstall

react-native-timezone

Package Overview
Dependencies
452
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-timezone

React Native library to extract mobile timezone


Version published
Weekly downloads
2.6K
increased by9.15%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

React Native Timezone

A Simple react native module to get Timezone of the Android/iOS device.

Motivation

For a project of mine, I had to acquire the current selected timezone of the user. But unfortunately I could not find any react native package or react native in-build function which facilitates this. Thus I created a small library.

Compatibility

React native versionTestedResult
< 0.60.0
>= 0.60.0

NOTE: Currently I've only tested this library with RN projects >= 0.60.0. If you tested this with older versions of RN, please let me know the status.

Installation

For RN version >= 0.60.0,

npm i --save react-native-timezone

iOS

cd ios/ && pod install

Android

Nothing else to do after npm install.

Usage

import TimeZone from 'react-native-timezone';

getTimeZone = async() => {
 const timeZone = await TimeZone.getTimeZone().then(zone => zone);
 console.log({ timeZone });
}

API

APIDescription
getTimeZoneAndroid : Returns timezone ID using java.util.TimeZone.getID()
iOS : This always reflects the current system time zone using localTimeZone of NSTimeZone

Keywords

FAQs

Last updated on 02 Jan 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc