You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a slight inconsistency in the way that days, months and years can be derived in the news model.
// File: EXT:news/Classes/Domain/Model/News.php
// Lines: 359 through 387
/**
* Get year of datetime
*
* @return false|string
*/
public function getYearOfDatetime()
{
return $this->getDatetime()->format('Y');
}
/**
* Get month of datetime
*
* @return false|string
*/
public function getMonthOfDatetime()
{
return $this->getDatetime()->format('m');
}
/**
* Get day of datetime
*
* @return int
*/
public function getDayOfDatetime(): int
{
return (int)$this->datetime->format('d');
}
Both the methods getYearOfDatetime and getMonthOfDatetime get the datetime information via getDatetime method, whilst the getDayOfDatetime method derives this data directly by access to the datetime property.
This seems inconsistent to me. I'd rather let all of them access the data either directly through the property or via the getter method.
Maybe there is a reason for that. Georg will know.
The text was updated successfully, but these errors were encountered:
GuidoJansenPI
changed the title
Inconsistency in news model datetime methos
Inconsistency in news model datetime getter methods
Jun 14, 2023
There is a slight inconsistency in the way that days, months and years can be derived in the news model.
Both the methods
getYearOfDatetime
andgetMonthOfDatetime
get the datetime information viagetDatetime
method, whilst thegetDayOfDatetime
method derives this data directly by access to thedatetime
property.This seems inconsistent to me. I'd rather let all of them access the data either directly through the property or via the getter method.
Maybe there is a reason for that. Georg will know.
The text was updated successfully, but these errors were encountered: