Comments (2)
months have different colors until I have more time to make this graph look nicer, please ignore all the time tracking for now
from sol.
@ospfranco : For the calculation of the lastDays
what do you think of a solution of these two, the times seem to be reduced.
const lNow = DateTime.now();
const lThreeMonthsAgo = lNow.minus({month: 3}).startOf("week");
let num = Math.ceil(lNow.diff(lThreeMonthsAgo, "days").days);
let lastDays = [...Array(num).keys()].reduce(
(acc, val) => [...acc, lThreeMonthsAgo.plus({day: val})],
[] as Array<DateTime>
);
o
let now = new Date();
let start = new Date(now.getFullYear(), now.getMonth() - 3, now.getDate());
// If date "overflowed" into next month, then bring it back:
if ((start.getMonth() + 3) % 12 != now.getMonth()) {
start.setDate(0); // Go to last day of previous month
}
// Go to previous Monday if not yet a Monday
start.setDate(start.getDate() - (start.getDay() + 6) % 7);
let lastDays = [];
while (start < now) {
lastDays.push(start.toLocaleDateString("en-SE")); // Format YYYY-MM-DD
start.setDate(start.getDate() + 1); // Next day
}
o
let now = new Date();
let start = new Date(now.getFullYear(), now.getMonth() - 3, now.getDate());
if ((start.getMonth() + 3) % 12 != now.getMonth()) start.setDate(0);
start.setDate(start.getDate() - (start.getDay() + 6) % 7);
const diffTime = Math.abs(now - start);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
let lastDays = [...Array(diffDays).keys()].reduce(
(acc, val) => {
let d = start.toLocaleDateString("en-SE")
start.setDate(start.getDate() + 1);
return [...acc, d]
},
[]
);
from sol.
Related Issues (20)
- for last two (or more) versions sparkle update check results in `Update Error!` HOT 7
- Calculator in launcher HOT 3
- How to run it in dev mode? HOT 3
- How to close this app? HOT 2
- Extra features went missing after an update. HOT 3
- How do I stop Sol from disappearing in a test environment? HOT 2
- Fuzzy search HOT 4
- No source files HOT 1
- Is the Emoji Picker working? HOT 4
- Linux build HOT 2
- How to manage shortcuts HOT 4
- add option to not autostart Sol on launch HOT 7
- Persistent Clipboard History HOT 4
- website throwing 404 HOT 1
- no issue
- Find App that are symlinked HOT 1
- Cannot open Safari HOT 1
- 1.1.94 crashing - updater failing to replace app, crash soon after open after manual install, app not signed HOT 15
- Enabling notifications crashes the app HOT 5
- Linux support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sol.