UX: Don't show "X days later" unless the posts are sequential.
This fixes the display of later posts when in summary mode.
This commit is contained in:
parent
fb03c13bc6
commit
0013477453
|
@ -6,12 +6,15 @@ function calcDayDiff(p1, p2) {
|
||||||
const date = p1.get('created_at');
|
const date = p1.get('created_at');
|
||||||
if (date) {
|
if (date) {
|
||||||
if (p2) {
|
if (p2) {
|
||||||
const lastDate = p2.get('created_at');
|
const numDiff = p1.get('post_number') - p2.get('post_number');
|
||||||
if (lastDate) {
|
if (numDiff === 1) {
|
||||||
const delta = new Date(date).getTime() - new Date(lastDate).getTime();
|
const lastDate = p2.get('created_at');
|
||||||
const days = Math.round(delta / (1000 * 60 * 60 * 24));
|
if (lastDate) {
|
||||||
|
const delta = new Date(date).getTime() - new Date(lastDate).getTime();
|
||||||
|
const days = Math.round(delta / (1000 * 60 * 60 * 24));
|
||||||
|
|
||||||
p1.set('daysSincePrevious', days);
|
p1.set('daysSincePrevious', days);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue