Skip to content

Commit d1697e4

Browse files
committed
fix: Fixed round nearest 15 min
1 parent daef2c3 commit d1697e4

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- Start and stop the timer for your current tasks
2222
- Edit timer by double-click on timer
2323
- Transfer the timer to the Redmine issue
24-
- Round time to nearest 15 min
24+
- Round timer to nearest 15 min
2525
- Search for issue (press `CTRL` + `K` or `CTRL` + `F`)
2626
- Dark & light mode (system default)
2727

src/components/issues/Issue.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,9 @@ const formatHours = (hours: number) => {
196196
*/
197197
const roundTimeNearestQuarterHour = (milliseconds: number) => {
198198
const seconds = milliseconds / 1000;
199-
let m = Math.floor((seconds / 60) % 60);
200-
m = (Math.round(m / 15) * 15) % 60;
201-
const h = Math.floor(seconds / 60 / 60);
202-
return (h * 60 + m) * 60 * 1000;
199+
const m = Math.round(Math.floor((seconds / 60) % 60) / 15) * 15;
200+
const h = Math.floor(seconds / 60 / 60) + Math.floor(m / 60);
201+
return (h * 60 + (m % 60)) * 60 * 1000;
203202
};
204203

205204
export default Issue;

src/pages/SettingsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const SettingsPage = () => {
4444
<Field type="password" name="redmineApiKey" title="Redmine API-Key" placeholder="Redmine API-Key" required as={InputField} error={touched.redmineApiKey && errors.redmineApiKey} />
4545
<h2 className="text-lg font-semibold">Options:</h2>
4646
<Field type="checkbox" name="options.autoPauseOnSwitch" title="Auto pause" description="Automatic pause timers when changing issue" as={CheckBox} />
47-
<Field type="checkbox" name="options.roundTimeNearestQuarterHour" title="Round time to nearest 15 min" description="Round time to nearest quarter hour" as={CheckBox} />
47+
<Field type="checkbox" name="options.roundTimeNearestQuarterHour" title="Round nearest 15 min" description="Round timer to nearest quarter hour" as={CheckBox} />
4848
<button
4949
type="button"
5050
className={clsx(

0 commit comments

Comments
 (0)