codefordenver / Comrad

Open-source web application for radio stations to manage show schedules, traffic and compliance
ISC License
25 stars 9 forks source link

Fix initial date values on FormDateRangeForExport #870

Closed kmid5280 closed 10 months ago

kmid5280 commented 10 months ago

Issue

This issue resolves #866

Description

This form was not correctly initializing the From and To dates when opened. Moved the conditional logic to set the initial date values into mapStateToProps.

kmid5280 commented 10 months ago

@seankwilliams Give this a try. I tested this fix and it seems to work, though I am a little unfamiliar with using initialValues in Redux Form. Might want to double check the usage of props vs state in this form just to make sure everything lines up okay.

I should note that previously in mapStateToProps, ownProps.initialValues was returning undefined and contained no values at all. I didn't see any evidence that ownProps.initialValues was being used for anything in this form. The new logic basically provides a new value for initialValues. If there is an instance where we need to pass in any values from ownProps.initialValues we may be able to set up a conditional that will account for that.

seankwilliams commented 10 months ago

This looks great. Nice work, @kmid5280 !