The code is missing a semicolon.
// check if this is to be a new post
if( $post_id != 'new' ) {
return $post_id
}
It should be as follows:
// check if this is to be a new post
if( $post_id != 'new' ) {
return $post_id;
}
But I was not able to achieve success with your code. I use the Date Picker field with default settings. It is right?