Closed
Description
trying to figure the right way to get flow to recognise this code where I can pass in a Date or a moment
I cant use native js typeofs as far as I can tell.
Know I could just do moment(date).format(...) but while moment is pretty efficient here, feels like there should be a better way to tell flow that isMoment is (basically) a type checking function?
if(moment.isMoment(date)){
return date.format(this.props.displayFormat);
// call of method format Property not found in [LIB] core.js:166:1,214:1: Date
}else{
return moment(date, this.props.inputFormat).format(this.props.displayFormat);
}