Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No tasks displayed on calendar. #91

Open
ruudvh opened this issue Jun 20, 2013 · 2 comments
Open

No tasks displayed on calendar. #91

ruudvh opened this issue Jun 20, 2013 · 2 comments
Labels
Milestone

Comments

@ruudvh
Copy link

ruudvh commented Jun 20, 2013

None of the tasks are shown on the calendar.

The issue is in functions.php, line 311:

$formatDate = $year . '-' . str_pad( $month, 2, 0, STR_PAD_LEFT ) . '-' .str_pad( $list_day, 2, 0, STR_PAD_LEFT ) . ' 00:00:00';

Which results in the following:
2013-06-15 00:00:00

This however is not how CollabPress dates in the database.
The database stores the following:
6/15/2013

Thus when running the query on the database for a task on a certain date, there is always zero results.

The fix seems obvious.
By changing $formatDate to the following it should work.

$formatDate = $month .'/' . $list_day . '/' . $year;

However:
Not sure what the "Date Format" in the admin menu does, for me it stays on "Custom" no matter what you select. Is this supposed to be how the date is stored? The resulting issue with this is that it seems to be that the above code is static and thus will always require the same format.

@ruudvh
Copy link
Author

ruudvh commented Jun 21, 2013

In regards to this, there seems to be an inconsistency with how the date is initially stored when a task is created. And how the date is stored after a task is edited.


Task added (content-single-project-tasks.php):
Display selector box:

<tr valign="top">
    <th scope="row"><label for="cp-task-due"><?php _e('Due: ', 'collabpress') ?></label></th>
    <td><p><input name="cp-task-due" class="cp-task-due-date" id="cp-task-due-date" class="regular-text" type="text" value=<?php echo date('n/j/Y') ?> /></p></td>
</tr>

Grab and store data:

jQuery('#cp-task-due-date').datepicker( {dateFormat: 'm/d/yy'} ); // init the datepicker
var data = {
    task_due_date: $('#cp-task-due-date').val(),

Task edit (content-single-task.php):
Display selector box:

<tr valign="top">
    <th scope="row"><label for="cp-task-due"><?php _e('Due: ', 'collabpress') ?></label></th>
    <td>
        <p>
            <input name="cp-task-due" class="cp-task-due-date" id="cp-task-due-date" class="regular-text" type="text" value=<?php echo cp_get_the_task_due_date(); ?> />
            <input id="cp-task-due-date-formatted" type="hidden" value="<?php echo str_replace( ' 00:00:00', '', cp_get_task_due_date_mysql( cp_get_task_id() ) ); ?>" />
        </p>
    </td>
</tr>

Grab and store data:

jQuery('#cp-task-due-date').datepicker( {
    altFormat: 'yy-mm-dd',
    altField: '#cp-task-due-date-formatted',
    dateFormat: '<?php echo cp_translate_date_format_for_js_datepicker() ?>'
})
.datepicker( 'setDate', '<?php echo cp_get_task_due_date( cp_get_task_id() ) ?>' ); // init the datepicker
var data = {
    task_due_date: $('#cp-task-due-date').val() + ' 00:00:00',

@williamsba williamsba added the Bug label Dec 23, 2014
@williamsba
Copy link
Member

This is definitely a bug and one I'd like to see fixed in v1.3.2

@williamsba williamsba added this to the 1.3.2 milestone Dec 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants