CFormatter::normalizeDateValue() as protected method #1977

Closed
etienneq opened this Issue Jan 14, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@etienneq
Contributor

etienneq commented Jan 14, 2013

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

This comment has been minimized.

Show comment Hide comment
@cebe

cebe Jan 15, 2013

Member

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.

Member

cebe commented Jan 15, 2013

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.

@ghost ghost assigned cebe Jan 15, 2013

@etienneq

This comment has been minimized.

Show comment Hide comment
@etienneq

etienneq Jan 16, 2013

Contributor

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.

Contributor

etienneq commented Jan 16, 2013

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 added a commit that referenced this issue Jan 30, 2013

Merge pull request #1978 branch '1977-CFormatter-normalizeDateValue-p…
…rotected' of https://github.com/etienneq/yii into etienneq-1977-CFormatter-normalizeDateValue-protected

* '1977-CFormatter-normalizeDateValue-protected' of https://github.com/etienneq/yii:
  minor change in changelog entry
  changelog
  #1977: declared CFormatter::normalizeDateValue() as protected

Conflicts:
	CHANGELOG

@cebe cebe closed this Jan 30, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment