DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:todo:customisations

ToDo Plugin

Customizations

Customize the date format

The todo plugin doesn't use the Date format set by strftime so if you want to use a date format other than yyyy/mm/dd you'll have to make some modifications.

Note that these modification will not survive updates.

Example:- Change to the Australian date format (dd/mm/yyyy)

  1. Edit action.php and change
    $newTag = preg_replace('/>/', ' #'.$user.':'.date('Y-m-d').'>', $todoTag)

    to

    $newTag = preg_replace('/>/', ' #'.$user.':'.date('d-m-Y').'>', $todoTag)
  2. Edit syntax/todo.php and change
    if(date('Y-m-d', strtotime($completeddate)) == $completeddate) {

    to

    if(date('d-m-Y', strtotime($completeddate)) == $completeddate) {

    , change

    case 'start':
    if(date('Y-m-d', strtotime($value)) == $value) {

    to

    case 'start':
    if(date('d-m-Y', strtotime($value)) == $value) {

    , and change

    case 'due':
                            if(date('Y-m-d', strtotime($value)) == $value) {

    to

    case 'due':
                            if(date('Y-m-d', strtotime($value)) == $value) {

    and change

    if(isset($data['start'])) { $return .= $data['start']->format('Y-m-d'); }
                $return .= ' → ';
                if(isset($data['due'])) { $return .= $data['due']->format('d-m-Y'); }

    to

    if(isset($data['start'])) { $return .= $data['start']->format('d-m-Y'); }
                $return .= ' → ';
                if(isset($data['due'])) { $return .= $data['due']->format('d-m-Y'); }
  3. Edit syntax/list.php and change
    if(date('Y-m-d', strtotime($date)) == $date) {
                        $result[0] = $date;
                    } elseif(preg_match('/^[\+\-]\d+$/', $date)) { // check if we have a valid relative va$
                        $newdate = date_create(date('Y-m-d'));
                        date_modify($newdate, $date . ' day');
                        $result[0] = date_format($newdate, 'Y-m-d');
                    } else { 
                        $result[0] = date('Y-m-d');
                    }
                }
            } else { $result[0] = date('Y-m-d'); }

    to

    if(date('d-m-Y', strtotime($date)) == $date) {
                        $result[0] = $date;
                    } elseif(preg_match('/^[\+\-]\d+$/', $date)) { // check if we have a valid relative va$
                        $newdate = date_create(date('d-m-Y'));
                        date_modify($newdate, $date . ' day');
                        $result[0] = date_format($newdate, 'd-m-Y');
                    } else { 
                        $result[0] = date('d-m-Y');
                    }
                }
            } else { $result[0] = date('d-m-Y'); }

    SFITCSScott Ferguson - IT and Business, Consulting & Support
    SFITCS

    2017-03-17 12:10

plugin/todo/customisations.txt · Last modified: 2018-02-28 11:09 by Aleksandr