<NME> dates.ts
<BEF> import * as dateMath from 'date-arithmetic'

let dates = Object.assign({}, dateMath, {
  merge(date?: Date | null, time?: Date | null, defaultDate?: Date) {
    if (time == null && date == null) return null

    if (time == null) time = defaultDate || new Date()
    if (date == null) date = defaultDate || new Date()

    date = dates.startOf(date, 'day')
    date = dates.hours(date, dates.hours(time))
    date = dates.minutes(date, dates.minutes(time))
    date = dates.seconds(date, dates.seconds(time))
    return dates.milliseconds(date, dates.milliseconds(time))
  },
})

export default dates

<MSG> fix(DatePicker): invalid dates prevent selecting new date

<DFF> @@ -1,17 +1,20 @@
 import * as dateMath from 'date-arithmetic'
 
+export let isNullOrInvalid = (dte: Date | null | undefined) =>
+  dte == null || isNaN(+dte)
+
 let dates = Object.assign({}, dateMath, {
   merge(date?: Date | null, time?: Date | null, defaultDate?: Date) {
-    if (time == null && date == null) return null
+    if (isNullOrInvalid(time) && isNullOrInvalid(date) == null) return null
 
-    if (time == null) time = defaultDate || new Date()
-    if (date == null) date = defaultDate || new Date()
+    if (isNullOrInvalid(time)) time = defaultDate || new Date()
+    if (isNullOrInvalid(date)) date = defaultDate || new Date()
 
-    date = dates.startOf(date, 'day')
-    date = dates.hours(date, dates.hours(time))
-    date = dates.minutes(date, dates.minutes(time))
-    date = dates.seconds(date, dates.seconds(time))
-    return dates.milliseconds(date, dates.milliseconds(time))
+    date = dates.startOf(date!, 'day')
+    date = dates.hours(date, dates.hours(time!))
+    date = dates.minutes(date, dates.minutes(time!))
+    date = dates.seconds(date, dates.seconds(time!))
+    return dates.milliseconds(date, dates.milliseconds(time!))
   },
 })
 

fix(DatePicker): invalid dates prevent selecting new date