Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ documents.label.activity.modified=Modified by {0}
documents.label.activity.moved=Moved by {0}
documents.label.activity.archived=Archived by {0}
documents.loadMore=Load more
documents.timeline.thisDay=Today ({0})
documents.timeline.thisWeek=Earlier this week ({0})
documents.timeline.thisMonth=Earlier this month ({0})
documents.timeline.thisYear=Earlier this year ({0})
documents.timeline.beforeThisYear=Before this year ({0})
documents.timeline.beforeThisYear=Never ({0})
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default {
headerExtensionApp: 'Documents',
headerExtensionType: 'timelineViewHeader',
headerExtensions: {},
dayFirstDay: 0,
weekFirstDay: 0,
monthFirstDay: 0,
yearFirstDay: 0,
Expand All @@ -108,14 +109,17 @@ export default {
if (this.grouping) {
return this.files && this.files.slice().map(file => {
const fileGrouping = JSON.parse(JSON.stringify(file));
if (this.weekFirstDay <= fileGrouping.modifiedDate) {
fileGrouping.groupValue = '1:thisWeek';
if (this.isToday(fileGrouping.modifiedDate)) {
fileGrouping.groupValue = '1:thisDay';
}
else if (this.weekFirstDay <= fileGrouping.modifiedDate) {
fileGrouping.groupValue = '2:thisWeek';
} else if (this.monthFirstDay <= fileGrouping.modifiedDate) {
fileGrouping.groupValue = '2:thisMonth';
fileGrouping.groupValue = '3:thisMonth';
} else if (this.yearFirstDay <= fileGrouping.modifiedDate) {
fileGrouping.groupValue = '3:thisYear';
fileGrouping.groupValue = '4:thisYear';
} else {
fileGrouping.groupValue = '4:beforeThisYear';
fileGrouping.groupValue = '5:beforeThisYear';
}
return fileGrouping;
}) || [];
Expand Down Expand Up @@ -161,6 +165,7 @@ export default {
},
},
created() {
this.dayFirstDay = this.getDayStart();
this.weekFirstDay = this.getWeekStart();
this.monthFirstDay = this.getMonthStart();
this.yearFirstDay = this.getYearStart();
Expand Down Expand Up @@ -188,6 +193,17 @@ export default {
this.headerExtensions = Object.assign({}, this.headerExtensions);
}
},
isToday (someDate){
const today = new Date();
const day = new Date(someDate);
return day.getDate() === today.getDate() &&
day.getMonth() === today.getMonth() &&
day.getFullYear() === today.getFullYear();
},
getDayStart() {
const now = new Date();
return now.getTime();
},
getWeekStart() { // Return Monday
const now = new Date();
const day = now.getDay();
Expand Down