Closed chrisgo closed 14 years ago
It's only used for the input() method.
How would you access this and other field-properties ? I've only used this so far:
$model->meta()->fields('fieldname')->pretty_format
How would you access this and other field-properties ?
Like you just did...
Ah, that's cool .. it just seemed like an inverted-shortcut to me at first, but it works
Maybe I am using this wrong ... this is how I came across this "issue" (or non-issue) - maybe there is a better way than to stuff this into the Model
I have a datetime field in the database (it's stored as Y-m-d G:i:s format in the database as opposed to a integer) so I put the formatting string in "format" (which works better than in Sprig). On my View, when I do something like
$object->create_date
it displays as a integer ... so I placed that get() method in Jelly_Field_Timestamp to display it in the "pretty-format".
Thinking about this more ... this is probably NOT a good idea as this could affect all the date calculations that operate on the integer format of the date.
Maybe the best way to implement this is to create a static method in a Model_Base like
Model_Base::formatDate($obj->create_date);
and just use it to "standardize" date outputs in the application
Thinking about this more ... this is probably NOT a good idea as this could affect all the date calculations that operate on the integer format of the date.
Probably not. I can't be entirely sure of the ramifications but Jelly converts all dates to a common format that can be easily used within PHP.
Your solution is fine, but you could also override the __get() method in Jelly_Model or create a field of your own that converts it to the pretty format so you have two fields, one that is dealing with the the time as a UNIX timestamp and the other that keeps it in the pretty format.
Jon, is this a bug or request and will it be resolved? Can you tag it appropriately?
It's a feature request and outside of the scope of Field_Timestamp. I'm closing it.
Is this implemented? Probably have to add a method inside Jelly_Field_Timestamp