Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

CFormatter::normalizeDateValue() as protected method #1977

Closed
etienneq opened this Issue · 2 comments

2 participants

@etienneq

I'd like to overwrite normalizeDateValue() in my derived Formatter class to format invalid date/time expressions as empty string instead of 1970-01-01...

To do so normalizeDateValue() should be defined as protected, not private.

I will provide a pull request.

@cebe
Owner

You can not return a string in normalizeDateValue() this will cause the date() function in format methods to fail.
You have to overwrite format methods instead.
Still making it protected might be a good change, let me think about it a short while.

@cebe cebe was assigned
@etienneq

Of course you're right. I realized that only after posting. Still what I've ended up doing is letting normalizeDateValue() return null for invalid date/time expressions and react to that in format methods. My idea is that any modification of a date/time expression should occur in normalizeDateValue() and not in any of the format methods.

@cebe cebe closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.