You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`minuteInterval`| The interval at which minutes can be selected. | <imgsrc="docs/minute-interval-ios.png"alt="Date picker minute interval IOS"height="120px" /> | <imgsrc="docs/minute-interval-android.png"alt="Date picker minute interval Android"height="120px" /> |
184
-
|`mode`| The date picker mode. `"datetime"`, `"date"`, `"time"`| <imgsrc="docs/datetime-mode-ios.png"alt="React native date time picker"height="120px" /><imgsrc="docs/date-mode-ios.png"alt="React native datepicker"height="120px" /><imgsrc="docs/time-mode-ios.png"alt="React native time picker"height="120px" /> | <imgsrc="docs/datetime-mode-android.png"alt="react native date time picker android"height="120px" /><imgsrc="docs/date-mode-android.png"alt="react native datepicker android"height="120px" /><imgsrc="docs/time-mode-android.png"alt="react native time picker android"height="120px" /> |
184
+
|`mode`| The date picker mode. `"datetime"`, `"date"`, `"time"`, `"yearAndMonth"`| <imgsrc="docs/datetime-mode-ios.png"alt="React native date time picker"height="120px" /><imgsrc="docs/date-mode-ios.png"alt="React native datepicker"height="120px" /><imgsrc="docs/time-mode-ios.png"alt="React native time picker"height="120px" /> | <imgsrc="docs/datetime-mode-android.png"alt="react native date time picker android"height="120px" /><imgsrc="docs/date-mode-android.png"alt="react native datepicker android"height="120px" /><imgsrc="docs/time-mode-android.png"alt="react native time picker android"height="120px" /> |
185
185
|`locale`| The locale for the date picker. Changes language, date order and am/pm preferences. Value needs to be a <atitle="react native datepicker locale id"href="https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html">Locale ID.</a> | <imgsrc="docs/locale-ios.png"alt="React Native Date picker locale language ios"height="120px" /> | <imgsrc="docs/locale-android.png"alt="React Native Date picker locale language android"height="120px" /> |
186
186
|`timeZoneOffsetInMinutes`| Timezone offset in minutes (default: device's timezone) |
187
187
|`is24hourSource`| Change how the 24h mode (am/pm) should be determined, by device settings or by locale. {'locale', 'device'} (android only, default: 'device') |
@@ -227,7 +227,7 @@ On iOS the 12/24h preference is determined by the `locale` prop. Set for instanc
227
227
228
228
### Is it possible to show only month and year?
229
229
230
-
This is unfortunately not possible due to the limitation in DatePickerIOS. You should be able to create your own month-year picker with for instance https://github.com/TronNatthakorn/react-native-wheel-pick.
230
+
Yes! You can use the `"yearAndMonth"` mode which displays only month and year selection on both platforms.
Here are some more info about the three different picker modes that are available.
258
+
Here are some more info about the different picker modes that are available.
259
259
260
260
### Date time picker
261
261
@@ -320,6 +320,23 @@ Set mode property to `time` to show the time picker:
320
320
/>
321
321
```
322
322
323
+
### Month Year picker
324
+
325
+
The yearAndMonth mode allows you to select only month and year, which is useful for selecting birth months, credit card expiration dates, or other month/year selections. This mode uses the native `UIDatePickerModeYearAndMonth`.
326
+
327
+
Set mode property to `yearAndMonth` to show the month year picker:
328
+
329
+
```jsx
330
+
<DatePicker
331
+
...
332
+
mode="yearAndMonth"
333
+
/>
334
+
```
335
+
336
+
**Compatibility Notes:**
337
+
-**iOS**: Displays the native year and month picker (`UIDatePickerModeYearAndMonth`)
338
+
-**Android**: Displays year and month wheels (without the date wheel)
339
+
323
340
## About
324
341
325
342
React Native Date Picker is a cross platform component for iOS and Android. It uses native code from respective platform to get the genuine look and feel the users expect. A strong motivation for creating this picker was the datetime mode on Android. It's quite unique for the platform and avoids two different picker popups, which normally is necessary. Instead, this datetime mode requires fewer user actions and enables a great user-experience.
0 commit comments