Date Picker Not Working

This topic contains 2 reply and 2 voices, and was last updated by Tareq Hasan 11 years, 8 months ago
Viewing 2 Posts - 1 through 2 (of 2 total)
Author Posts
March 31, 2013 at 6:27 pm 1693
Tareq Hasan When I pick a date for a milestone or task, the date changes to the day before upon saving. This happens in both the admin and front-end pages. If I go back to edit the date, it will not let me pick a new date, but rather I have to type in the date manually and upon saving, it still shows the wrong date. I also have an issue with the date picker when editing a milestone. If I hit the arrow to go to the next month, it shows January 1900 as the year. Again this happens on both the admin and front-end pages. Any ideas on how to fix this? Perhaps there is a date picker compatibility issue? I'm using WP version 3.5.1 and project manager 0.4.2, and the front-end version 1.1. I really like your plugin and would like to use this!
April 8, 2013 at 8:03 pm 1942
hmmcreative hmmcreative

I’ve been doing some research and looking into your code. I solved the first problem I have where the milestones change upon saving to the previous date. This also occurred when saving tasks. I found that your function cpm_date2mysql was where the date is converted to a timestamp and saved in the database for both the milestones and tasks. I changed the following $gmt value from o to 1 and it now writes the correct date upon saving both milestones and tasks.

File is functions.php line 97:

function cpm_date2mysql( $date, $gmt = 1 ) {
$time = strtotime( $date );
return ( $gmt ) ? date( ‘Y-m-d H:i:s’, $time ) : date( ‘Y-m-d H:i:s’, ( $time + ( get_option( ‘gmt_offset’ ) * 3600 ) ) );
}

April 9, 2013 at 10:05 am 1962
Tareq Hasan Tareq Hasan

Hmm, interesting. May be your servers time is different than your sites configured date and that way the problem comes in. I’ve to test more. Glad to know that works for you 🙂

Viewing 2 Posts - 1 through 2 (of 2 total)