Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
MMXII Posted April 29, 2018 Posted April 29, 2018 I wanted to change the first day of the week from sunday to monday. However I found no option to achieve this, so how can I do this? I noticed that when using 'Unread Content' (Activities) content that has been created before sundays will show up under 'Last week'. Is this a bug? Can it even be configured somewhere?
MMXII Posted April 29, 2018 Author Posted April 29, 2018 This setting actually is enabled, so the week should start on Monday (it does in the Calendar, but only there). However the Activities Stream ('Unread Content') is still incorrect, displaying content from yesterday (a saturday) that is being viewed today ( a sunday) as last week's content (although it should still be this week).
bfarber Posted April 30, 2018 Posted April 30, 2018 Can you take a screenshot of exactly what you are seeing?
MMXII Posted April 30, 2018 Author Posted April 30, 2018 21 minutes ago, bfarber said: Can you take a screenshot Sure. I have added some additional info. I hope it explains what the issue is that I am having here. When looking at the screenshot, please note that I opened the Unread Content Stream on Sunday, and the content that is listed under "Last Week" is from one day before (Saturday) and from two days before (Friday). So the "cut" between last week and the current week seems to be on sunday there.
Adlago Posted May 2, 2018 Posted May 2, 2018 Last week's stream is not counted as a calendar last week, but the last 7 days are counted as a one-week interval including yesterday.
MMXII Posted May 2, 2018 Author Posted May 2, 2018 But wouldn't that mean that a post made yesterday always show up as being posted "yesterday" (and not "last week")?
Adlago Posted May 2, 2018 Posted May 2, 2018 Yesterday is part of the past 7 days, but the closest day.
MMXII Posted May 2, 2018 Author Posted May 2, 2018 However if I don't take a look at the splitting point between saturday and sunday, it actually shows "yesterday", "last hour" and such... So, for example, a post made on wednesday and the unread content tab being looked at on thursday, it then says "yesterday" (for the content that has been posted on wednesday), not "last week". The splitting point seems to be between saturday and sunday.
Adlago Posted May 2, 2018 Posted May 2, 2018 No, there is no separation between Saturday and Sunday. From today starts counting last week. (or past 7 days). Used "Yesterday", as the first and the closest day to today. And also for the first day of the past 7 days. Perhaps the term "Last week" is not quite accurate for all of us who use other languages, but you can easily use it for translation - 7 days gone by or if you like another - 6 days before (or after) yesterday.
MMXII Posted May 2, 2018 Author Posted May 2, 2018 I am afraid I do not understand the logic behind that. When I watch a post today (Wednesday) that has been created yesterday (Tuesday), it says "Yesterday". When I watch a post the upcoming Sunday that has been created the day before (Saturday), it will not say "Yesterday", but "Last Week". I see a difference there. And so do my users, because they wonder how yesterday can be last week in certain circumstances (that is, if today is a sunday).
Adlago Posted May 2, 2018 Posted May 2, 2018 The logic is simple. When discussing a past week, including Monday-Sunday days, as it is at Calendar, it describes the "Previous Week". When we look at a stream of information lasting one week, and it should be noted that this is information that has passed before today, it is used "Last Week". This determination is independent of the Calendar, but only a number of days equal to 7. "Yesterday" was the first day of last week.
MMXII Posted May 2, 2018 Author Posted May 2, 2018 But why is it that "Yesterday" only (always!) shows up from Monday till Saturday, but on Sunday there is never a "Yesterday" (only "Last Week")? I think I get what you are trying to explain here, but if that is the case, is this stream of unread content really displaying information as intended?
bfarber Posted May 3, 2018 Posted May 3, 2018 public function streamSeparator( $createdDate=TRUE ) { $date = $createdDate ? $this->createdDate : $this->lastUpdatedDate; $now = \IPS\DateTime::ts( time() ); $yesterday = clone $now; $yesterday = $yesterday->sub( new \DateInterval('P1D') ); $diff = $date->diff( $now ); if ( $date->format('Y-m-d') == $yesterday->format('Y-m-d') ) { return 'yesterday'; } elseif ( $diff->h < 1 && !$diff->d && !$diff->m ) { return 'past_hour'; } elseif ( $date->format('Y-m-d') == $now->format('Y-m-d') ) { return 'today'; } elseif ( !$diff->y and !$diff->m and $diff->d < 7 ) { return 'last_week'; } else { return 'earlier'; } } We generate a datetime object for "now" and one for yesterday (now minus 1 day), and we have a datetime object for the stream result. If the stream result date is the same as yesterday's date, we show a 'yesterday' separator. If the difference between the result and now is less than an hour, we show 'past hour'. If the date is the same as today we show 'today'. If the difference is less than a week, we show 'last week'. Otherwise we show 'earlier'. I am unsure why you do not see a 'yesterday' separator if the difference is less than a day. We would need to login and look at that on your site while the issue is occurring, I would expect. The code makes no distinction as to when a week actually starts or ends.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.