Skip to content
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

Pomo timer shows incorrect time left #31

Open
A-raj468 opened this issue Sep 4, 2024 · 6 comments
Open

Pomo timer shows incorrect time left #31

A-raj468 opened this issue Sep 4, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@A-raj468
Copy link

A-raj468 commented Sep 4, 2024

🐛 Describe the bug

The issue

When I set a pomo timer of more than 60s, when displaying the timer additional 30m are added to the minute fields.
Eg: If I set a timer for 20m, it will show 50m, if I set timer for 1m 15s, it shows 31m 15s, ets. (One example included in the screenshot below)
The actual timer works correctly. Only the display, both in noice display box and lualine, are wrong.

Config(using lazy package manager):

return {
    {
        -- Pomodoro timer
        'epwalsh/pomo.nvim',
        version = '*',
        lazy = true,
        cmd = { 'TimerStart', 'TimerRepeat', 'TimerSession' },
        dependencies = {
            'rcarriga/nvim-notify',
        },
    },
}

My nvim config: nvim-config

Example screenshot

Setting pomo timer for 75s:

image

Timer showing 31m 10s

image

Timer goes to 59s once 16s have passed from original timer

image

Versions

nvim --version
NVIM v0.10.0
Build type: RelWithDebInfo
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more infonvim --headless -c 'lua print(require("pomo.version"))' -c q
0.7.0

My lazy-lock.json file.

@A-raj468 A-raj468 added the bug Something isn't working label Sep 4, 2024
@tonnycheruiyot
Copy link

I guess the minutes bit was fixed. The issue now is with the hour display. If the time left is beyond 1h, the time left is shown as x+3h, eg, If you set the timer to 1h30m, both the time left is displayed as 4h30m

@A-raj468
Copy link
Author

For me, both the issues are there minutes showing additional 30m and hour showing additional 5h.

@A-raj468
Copy link
Author

I realized the issue is that when formatting the time string, in the util.lua module the formatting function uses os.date("%Mm %Ss", time_left). This uses the local time zone to display the time(which in my case is UTC+0530, additional 5hr and 30min). This is exactly the additional time added in the display.

Using UTC to format instead of local time zone fixes the issue. Changing the format string in os.date as os.date("!%Mm %Ss", time_left) forces the os.date module to use UTC instead of local time zone.

I have requested this change in the PR #32. Hopefully the maintainer merges this change after reviewing it.

@tonnycheruiyot
Copy link

That actually makes sense. I hope the pr gets merged soon.

@dfenerski
Copy link

Hey, I experience this too on a fresh install. Any progress with the PR?

@A-raj468
Copy link
Author

A-raj468 commented Sep 28, 2024

Nah, he hasn't replied yet to the PR. For now, I am using my fork. You can also use that if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants