Add ability to edit date fields

Also does some minor refactoring of weirdness I found while implementing this.