The AttributeType::DateTime
in model attributes saves as UTC which is great, but upon getting that attribute I receive a Craft\DateTime
object with my server timezone set for it, and thus the time gets modified accordingly.
Is there any way I could force the model to return a Craft\DateTime
object with the UTC timezone?
When I created a getter method public function getDate()
it doesn't get called when using object.date
inside a Twig template. I have to specifically call object.getDate()
instead, which isn't really an option for me.
This is how my model defines attributes:
protected function defineAttributes()
{
return array(
'date' => AttributeType::DateTime,
)
}
Maybe there are some additional rules I can set for it, that I am not aware of? I couldn't find anything in Yii's documentation.