By David Montoya on Monday, 16 May 2016
Posted in General Issues
Likes 0
Views 371
Votes 0
Original Post

I'm getting a weird result. Instead of the post's date, I'm getting what appears to be today's date. Here's my snippet:

$postDate = EB::date($post->getAsset('created_at')->getValue(), true);
echo
EBR::_('index.php?option=com_easyblog&view=calendar&'.
'year='.$postDate->format('Y').'&'.
'month='.$postDate->format('m').'&'.
'day='. $postDate->format('d')).' "
data-original-title="'.
JText::_('COM_EASYBLOG_POST_DATE').' '.
$postDate->format(JText::_('COM_EASYBLOG_POST_DATE_FORMAT_MONTH')).' '.
$postDate->format(JText::_('COM_EASYBLOG_POST_DATE_FORMAT_DAY')).' '.
$postDate->format(JText::_('COM_EASYBLOG_POST_DATE_YEAR')).' "
data-placement="right" data-eb-provide="tooltip">';


//Language Keys
; EasyBlog Custom Strings
COM_EASYBLOG_CATEGORY_TOOLTIP= "Search by Category:"
COM_EASYBLOG_CONTINUE_READING= "Continue reading <i class="fa fa-angle-double-right"></i>"
COM_EASYBLOG_EXTERNAL_LINK_TOOLTIP= "Continue reading in new tab"
COM_EASYBLOG_POST_DATE= "View all posts from"
COM_EASYBLOG_POST_DATE_FORMAT_DAY= "dS"
COM_EASYBLOG_POST_DATE_FORMAT_MONTH="F"
COM_EASYBLOG_POST_DATE_YEAR= "o"
COM_EASYBLOG_TAG_TOOLTIP= "Search by Tag:"
COM_EASYBLOG_YOUTUBE_TOOLTIP= "Watch video"
oh, I think you can't use that above code to get the post date is because that code is only get these is tweet post type.


$postDate = EB::date($post->getAsset('created_at')->getValue(), true);

// Try replace to this code to get the each post created date
$postDate = $post->getDisplayDate($this->params->get('post_date_source', 'created');
·
Monday, 16 May 2016 11:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Hey David,

I am sorry for the delay of this reply,

May i know which weird result are you getting?

Because I've tried in my locally, it seems it print out the correct result :

/easyblog/calendar/2016/05/16 "
data-original-title="View all posts from May 16th 2016 "
data-placement="right"
data-eb-provide="tooltip">
·
Monday, 16 May 2016 10:26
·
0 Likes
·
0 Votes
·
0 Comments
·
I'm using it on the Latest view. On every post it returns today's date and not the individual post's date. You can see this effect in the URL provided.
·
Monday, 16 May 2016 10:46
·
0 Likes
·
0 Votes
·
0 Comments
·
That appears to have worked. New snippet for anyone trying to do similar:
$postDate = $post->getDisplayDate($this->params->get('post_date_source', 'created'));
echo
EBR::_('index.php?option=com_easyblog&view=calendar&'.
'year='.$postDate->format('Y').'&'.
'month='.$postDate->format('m').'&'.
'day='. $postDate->format('d')).' "
data-original-title="'.
JText::_('COM_EASYBLOG_POST_DATE').' '.
$postDate->format(JText::_('COM_EASYBLOG_POST_DATE_FORMAT_MONTH')).' '.
$postDate->format(JText::_('COM_EASYBLOG_POST_DATE_FORMAT_DAY')).' '.
$postDate->format(JText::_('COM_EASYBLOG_POST_DATE_YEAR')).' "
data-placement="right" data-eb-provide="tooltip">';

//Language Keys
; EasyBlog Custom Strings
COM_EASYBLOG_CATEGORY_TOOLTIP= "Search by Category:"
COM_EASYBLOG_CONTINUE_READING= "Continue reading <i class="fa fa-angle-double-right"></i>"
COM_EASYBLOG_EXTERNAL_LINK_TOOLTIP= "Continue reading in new tab"
COM_EASYBLOG_POST_DATE= "View all posts from"
COM_EASYBLOG_POST_DATE_FORMAT_DAY= "dS"
COM_EASYBLOG_POST_DATE_FORMAT_MONTH="F"
COM_EASYBLOG_POST_DATE_YEAR= "o"
COM_EASYBLOG_TAG_TOOLTIP= "Search by Tag:"
COM_EASYBLOG_YOUTUBE_TOOLTIP= "Watch video"
·
Monday, 16 May 2016 11:51
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for updating, glad that your issues are resolved now
·
Monday, 16 May 2016 12:41
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post