Skip to content

Commit 02a2430

Browse files
Merge pull request #11 from DanielGilbert/dev
Release v0.1.5
2 parents 49de47a + 056261e commit 02a2430

File tree

5 files changed

+25
-18
lines changed

5 files changed

+25
-18
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
## [0.1.5] - 2022-01-31
11+
12+
### Changed
13+
14+
- Prevents filling the whole week or month in advance.
15+
1016
## [0.1.4] - 2022-01-11
1117

1218
### Added

extension/kenbuddy.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@
99

1010

1111
async function fillToday(statusContainer, schedule, entropyMinutes) {
12-
let date = new Date();
12+
var date = new Date();
1313
const startOfToday = startOfDay(date);
1414
const endOfToday = endOfDay(date);
1515
await fillFor(statusContainer, startOfToday, endOfToday, schedule, entropyMinutes);
1616
}
1717

1818
async function fillCurrentMonth(statusContainer, schedule, entropyMinutes) {
19-
let currentDate = new Date();
19+
var currentDate = new Date();
2020
const monthStart = startOfMonth(currentDate);
21-
const monthEnd = endOfMonth(currentDate);
21+
const monthEnd = endOfDay(currentDate);
2222
await fillFor(statusContainer, monthStart, monthEnd, schedule, entropyMinutes);
2323
}
2424

2525
async function fillCurrentWeek(statusContainer, schedule, entropyMinutes) {
26-
let currentDate = new Date();
27-
const weekStart = currentDate.getStartOfWeek();
28-
const weekEnd = currentDate.getEndOfWeek();
26+
var currentDate = new Date();
27+
const weekStart = getStartOfWeek(currentDate);
28+
const weekEnd = endOfDay(currentDate);
2929
await fillFor(statusContainer, weekStart, weekEnd, schedule, entropyMinutes);
3030
}
3131

@@ -34,6 +34,7 @@ var localEntropyMinutes = 0;
3434
var showFillMonth = false;
3535
var showFillWeek = true;
3636
var showFillToday = false;
37+
var allowEntriesInTheFuture = false;
3738

3839
(async function() {
3940
/* Make schedule and entropy configurable */
@@ -103,8 +104,8 @@ var showFillToday = false;
103104
let date = new Date();
104105
const today = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0));
105106

106-
const startOfWeek = date.getStartOfWeek();
107-
const endOfWeek = date.getEndOfWeek();
107+
const startOfWeek = getStartOfWeek(date);
108+
const endOfWeek = endOfDay(date);
108109
let auth = await getAuth();
109110
let user = await getUser(auth);
110111
hasEntryForToday = await userHasEntryFor(auth, user.ownerId, today);

extension/manifest_v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 2,
33
"name": "kenBuddy",
44
"description": "__MSG_extensionDescription__",
5-
"version": "0.1.4",
5+
"version": "0.1.5",
66
"icons": {
77
"16": "logo/logo-16.png",
88
"48": "logo/logo-48.png",

extension/manifest_v3.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 3,
33
"name": "kenBuddy",
44
"description": "__MSG_extensionDescription__",
5-
"version": "0.1.4",
5+
"version": "0.1.5",
66
"icons": {
77
"16": "logo/logo-16.png",
88
"48": "logo/logo-48.png",

extension/utils/utils.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,18 +74,18 @@ function endOfMonth(date) {
7474
return new Date(Date.UTC(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59, 999));
7575
}
7676

77-
function hhmmToMinutes(str) {
78-
return str.split(':').reduce((acc, curr) => (acc*60) + +curr);
77+
function getStartOfWeek(date) {
78+
var currentDate = startOfDay(date);
79+
return new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay()));
7980
}
8081

81-
Date.prototype.getStartOfWeek = function() {
82-
var date = new Date(this.setDate(this.getDate() - this.getDay()));
83-
return startOfDay(date);
82+
function getEndOfWeek(date) {
83+
var currentDate = endOfDay(date);
84+
return new Date(currentDate.setDate(currentDate.getDate() - currentDate.getDay() + 6));
8485
}
8586

86-
Date.prototype.getEndOfWeek = function() {
87-
var date = new Date(this.setDate(this.getDate() - this.getDay() + 6));
88-
return startOfDay(date);
87+
function hhmmToMinutes(str) {
88+
return str.split(':').reduce((acc, curr) => (acc*60) + +curr);
8989
}
9090

9191
const checkElement = async selector => {

0 commit comments

Comments
 (0)