react-native-timezone 2.1.0 → 2.2.0
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/README.md +35 -27
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React Native Timezone
|
|
2
|
+
[](https://codeclimate.com/github/samitha9125/react-native-timezone/maintainability)
|
|
2
3
|
|
|
3
4
|
A Simple react native module to get Timezone of the Android/iOS device.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
# Motivation
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
# Compatibility
|
|
10
|
+
Timezone version 2.0.0 only support React Native version 0.62.3 and above due to React Native Regular Expression Denial of Service (ReDoS) vulnerability.
|
|
11
|
+
|
|
12
|
+
| React native version | Tested | Result |
|
|
13
|
+
|----------------------|--------|--------|
|
|
14
|
+
| 0.62.3 + | ✅ | ✅ |
|
|
15
|
+
| 0.62.5 + | ✅ | ✅ |
|
|
16
|
+
| 0.71.3 + | ✅ | ✅ |
|
|
17
|
+
|
|
18
|
+
# Installation
|
|
19
|
+
|
|
20
|
+
`npm i react-native-timezone`
|
|
21
|
+
|
|
22
|
+
## iOS
|
|
23
|
+
|
|
24
|
+
Do `cd ios/ && pod install`.
|
|
25
|
+
|
|
26
|
+
# Usage
|
|
27
|
+
```javascript
|
|
28
|
+
import TimeZone from 'react-native-timezone';
|
|
29
|
+
|
|
30
|
+
getTimeZone = async() => {
|
|
31
|
+
const timeZone = await TimeZone.getTimeZone().then(zone => zone);
|
|
32
|
+
console.log({ timeZone });
|
|
33
|
+
}
|
|
19
34
|
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## License
|
|
26
|
-
|
|
27
|
-
MIT
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
35
|
+
Check out the [example]("https://github.com/samitha9125/react-native-timezone/tree/master/example") folder.
|
|
36
|
+
# API
|
|
37
|
+
| API | Description |
|
|
38
|
+
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
39
|
+
| getTimeZone | Android : Returns timezone ID using java.util.TimeZone.getID()<br>iOS : This always reflects the current system time zone using localTimeZone of NSTimeZone |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-timezone",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "A Simple react native module to get Timezone of the Android/iOS device.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"react-native": "*"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|
|
84
|
-
"node": ">=
|
|
84
|
+
"node": ">= 14.0.0"
|
|
85
85
|
},
|
|
86
86
|
"packageManager": "^yarn@1.22.15",
|
|
87
87
|
"jest": {
|