Skip to content

scriptmanager can't handle roundcube different date formarts #14

@sleepdead

Description

@sleepdead

The preg_replace function that formats the date on the scriptmanager.php file can't handle different roundcube data formats.

I did something very ugly on my file but it's working. I don't really know what is the best approach.

This is what I did:

# for the format with non decimal characters
            $startDate = preg_replace('#(\d).(\d\d).(\d\d\d\d)#','0$1-$2-$3',$params['start']);
            $startDate = preg_replace('#(\d\d).(\d).(\d\d\d\d)#','$1-0$2-$3',$startDate);

            $endDate = preg_replace('#(\d).(\d\d).(\d\d\d\d)#','0$1-$2-$3',$params['end']);
            $endDate = preg_replace('#(\d\d).(\d).(\d\d\d\d)#','$1-0$2-$3',$endDate);
# the usual one
            $startDate = preg_replace('#(\d\d).(\d\d).(\d\d\d\d)#','$3-$2-$1',$startDate);
            $endDate = preg_replace('#(\d\d).(\d\d).(\d\d\d\d)#','$3-$2-$1',$endDate);
# if none of the above match and the separator may vary
            $startDate = preg_replace('#(\d\d\d\d).(\d\d).(\d\d)#','$1-$2-$3',$startDate);
            $endDate = preg_replace('#(\d\d\d\d).(\d\d).(\d\d)#','$1-$2-$3',$endDate); 

hope this helps =D

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions