Skip to content

_base_parseDate() NOT throwing an exception in splitDateTime #432

Closed
@mpatnode

Description

@mpatnode

The current implementation of splitDateTime seems to rely upon _base_parseDate()
throwing an exception, and then parsing the results of that exception.
This seems rather error prone since an exception is being used for
a non-exceptional (expected) condition and the code is subject to breakage if the format of the
exception message changes. But my problem was that the dateTimeString parsed just fine (even
though the default date format did not include the time) so no exception was thrown, and the code
would always cut off the time segment. So I added code that handles the case where
_base_parseDate() doesn't throw, and just split the dateTimeString on the separator.

I'd be interested to hear if I was doing something wrong which was causing parseDate() not to
fail, but once again depending upon the exception to be thrown seems like trouble to me...

My fix is here. I only had read-only access to your source:

mpatnode@dcd217f

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