Skip to content

adding time in calculations of yesterday and today #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from 2 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
26 changes: 16 additions & 10 deletions src/scripts/scrumHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ function allIncluded() {
var today = new Date();
var noDays_to_goback = gsoc == 0 ? 7 : 1;
var lastWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() - noDays_to_goback);
lastWeek.setHours(0, 0, 0, 0);

var lastWeekMonth = lastWeek.getMonth() + 1;
var lastWeekDay = lastWeek.getDate();
var lastWeekYear = lastWeek.getFullYear();
Expand All @@ -113,22 +115,26 @@ function allIncluded() {
'-' +
('00' + lastWeekMonth.toString()).slice(-2) +
'-' +
('00' + lastWeekDay.toString()).slice(-2);
('00' + lastWeekDay.toString()).slice(-2) +
'T00:00:00Z';
return lastWeekDisplayPadded;
}
function getToday() {
var today = new Date();
var Week = new Date(today.getFullYear(), today.getMonth(), today.getDate());
var WeekMonth = Week.getMonth() + 1;
var WeekDay = Week.getDate();
var WeekYear = Week.getFullYear();
var WeekDisplayPadded =
('0000' + WeekYear.toString()).slice(-4) +
today.setHours(23, 59, 59, 999);
var week = new Date(today.getFullYear(), today.getMonth(), today.getDate());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your variable name is confusing. Its name is week, but the value seems to be a single date.

week.setHours(23, 59, 59, 999);
var weekMonth = week.getMonth() + 1;
var weekDay = week.getDate();
var weekYear = week.getFullYear();
var weekDisplayPadded =
('0000' + weekYear.toString()).slice(-4) +
'-' +
('00' + WeekMonth.toString()).slice(-2) +
('00' + weekMonth.toString()).slice(-2) +
'-' +
('00' + WeekDay.toString()).slice(-2);
return WeekDisplayPadded;
('00' + weekDay.toString()).slice(-2) +
'T23:59:59Z';
return weekDisplayPadded;
}
// fetch github data
function fetchGithubData() {
Expand Down