Skip to content

Commit dfc7ad5

Browse files
committed
docs: readme
1 parent 86ab6b4 commit dfc7ad5

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

README.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,24 +66,25 @@ React Native date & time picker component for iOS, Android and Windows.
6666
- [`value` (`required`)](#value-required)
6767
- [`maximumDate` (`optional`)](#maximumdate-optional)
6868
- [`minimumDate` (`optional`)](#minimumdate-optional)
69+
- [`timeZoneName` (`optional`, `iOS or Android only`)](#timezonename-optional-ios-and-android-only)
6970
- [`timeZoneOffsetInMinutes` (`optional`, `iOS or Android only`)](#timezoneoffsetinminutes-optional-ios-and-android-only)
7071
- [`timeZoneOffsetInSeconds` (`optional`, `Windows only`)](#timezoneoffsetinsecond-optional-windows-only)
71-
- [`dayOfWeekFormat` (`optional`, `Windows only`)](#dayOfWeekFormat-optional-windows-only)
72-
- [`dateFormat` (`optional`, `Windows only`)](#dateFormat-optional-windows-only)
73-
- [`firstDayOfWeek` (`optional`, `Windows only`)](#firstDayOfWeek-optional-windows-only)
74-
- [`textColor` (`optional`, `iOS only`)](#textColor-optional-ios-only)
75-
- [`accentColor` (`optional`, `iOS only`)](#accentColor-optional-ios-only)
72+
- [`dayOfWeekFormat` (`optional`, `Windows only`)](#dayofweekformat-optional-windows-only)
73+
- [`dateFormat` (`optional`, `Windows only`)](#dateformat-optional-windows-only)
74+
- [`firstDayOfWeek` (`optional`, `Windows only`)](#firstdayofweek-optional-windows-only)
75+
- [`textColor` (`optional`, `iOS only`)](#textcolor-optional-ios-only)
76+
- [`accentColor` (`optional`, `iOS only`)](#accentcolor-optional-ios-only)
7677
- [`themeVariant` (`optional`, `iOS only`)](#themevariant-optional-ios-only)
7778
- [`locale` (`optional`, `iOS only`)](#locale-optional-ios-only)
7879
- [`is24Hour` (`optional`, `Windows and Android only`)](#is24hour-optional-windows-and-android-only)
79-
- [`positiveButton` (`optional`, `Android only`)](#positiveButton-optional-android-only)
80-
- [`negativeButton` (`optional`, `Android only`)](#negativeButton-optional-android-only)
81-
- [`neutralButton` (`optional`, `Android only`)](#neutralButton-optional-android-only)
80+
- [`positiveButton` (`optional`, `Android only`)](#positivebutton-optional-android-only)
81+
- [`negativeButton` (`optional`, `Android only`)](#negativebutton-optional-android-only)
82+
- [`neutralButton` (`optional`, `Android only`)](#neutralbutton-optional-android-only)
8283
- [`minuteInterval` (`optional`)](#minuteinterval-optional)
8384
- [`style` (`optional`, `iOS only`)](#style-optional-ios-only)
8485
- [`disabled` (`optional`, `iOS only`)](#disabled-optional-ios-only)
8586
- [`view props` (`optional`, `iOS only`)](#view-props-optional-ios-only)
86-
- [`onError` (`optional`, `Android only`)](#onError-optional-android-only)
87+
- [`onError` (`optional`, `Android only`)](#onerror-optional-android-only)
8788
- [Testing with Jest](#testing-with-jest)
8889
- [Migration from the older components](#migration-from-the-older-components)
8990
- [Contributing to the component](#contributing-to-the-component)
@@ -309,11 +310,13 @@ This is called when the user changes the date or time in the UI. It receives the
309310
It is also called when user dismisses the picker, which you can detect by checking the `event.type` property.
310311
The values can be: `'set' | 'dismissed' | 'neutralButtonPressed'`. (`neutralButtonPressed` is only available on Android).
311312

313+
The `utcOffset` field is only available on Android and iOS. It is the offset in minutes between the selected date and UTC time.
314+
312315
```js
313316
const setDate = (event: DateTimePickerEvent, date: Date) => {
314317
const {
315318
type,
316-
nativeEvent: {timestamp},
319+
nativeEvent: {timestamp, utcOffset},
317320
} = event;
318321
};
319322

@@ -344,10 +347,20 @@ Defines the minimum date that can be selected. Note that on Android, this only w
344347
<RNDateTimePicker minimumDate={new Date(1950, 0, 1)} />
345348
```
346349

350+
#### `timeZoneName` (`optional`, `iOS and Android only`)
351+
352+
Allows changing of the time zone of the date picker. By default, it uses the device's time zone.
353+
Use the time zone name from the IANA (TZDB) database name in https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
354+
355+
```js
356+
// GMT+1
357+
<RNDateTimePicker timeZoneOffsetInMinutes={60} />
358+
```
359+
347360
#### `timeZoneOffsetInMinutes` (`optional`, `iOS and Android only`)
348361

349-
Allows changing of the timeZone of the date picker. By default, it uses the device's time zone.
350-
We strongly recommend avoiding this prop on android because of known issues in the implementation (eg. [#528](https://github.com/react-native-datetimepicker/datetimepicker/issues/528)).
362+
Allows changing of the time zone of the date picker. By default, it uses the device's time zone.
363+
We strongly recommend using `timeZoneName` instead; this prop has known issues in the android implementation (eg. [#528](https://github.com/react-native-datetimepicker/datetimepicker/issues/528)).
351364

352365
```js
353366
// GMT+1

src/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export type EvtTypes = 'set' | 'neutralButtonPressed' | 'dismissed';
1919
export type DateTimePickerEvent = {
2020
type: EvtTypes;
2121
nativeEvent: {
22-
timestamp?: number;
22+
timestamp: number;
23+
utcOffset: number;
2324
};
2425
};
2526

0 commit comments

Comments
 (0)