Correct strategy for using datepicker attached to an input field with Liveview?

My man do you know how much heartburn I suffered today trying to fix this god forsaken thing and your solution pulled me from the depths of hades out of the clutches of Mephistopheles himself?