From 0fc9a002da2a041786255d4f6ced9f9ba3ab4f8a Mon Sep 17 00:00:00 2001 From: MaxInMoon Date: Wed, 26 Sep 2018 17:54:57 +0200 Subject: [PATCH] Fix DatePickerAndroid error when passing "minDate: null" It avoids an error when passing an `options` object with `minDate: null`. Inspired by isObjectLike from Loadash (https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L11771-L11773). --- .../Components/DatePickerAndroid/DatePickerAndroid.android.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js b/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js index 734a59abf72cf4..3fb4b0888b5a95 100644 --- a/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +++ b/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js @@ -18,7 +18,7 @@ const DatePickerModule = require('NativeModules').DatePickerAndroid; function _toMillis(options: Object, key: string) { const dateVal = options[key]; // Is it a Date object? - if (typeof dateVal === 'object' && typeof dateVal.getMonth === 'function') { + if (dateVal != null && typeof dateVal == 'object' && typeof dateVal.getMonth === 'function') { options[key] = dateVal.getTime(); } }