Code Monkey home page Code Monkey logo

Comments (4)

Byron avatar Byron commented on June 4, 2024 1

Happily!

(it took me moment to realise, but I think instead of 'measurement' it should be 'measure')

Regarding 1), I really like the idea of a fuzzy & smart country selector to nail the current timezone. I think it should be made clear that this setting only affects changes done after timezone change (even if it means to stop a timer in a new timezone, like would be the case in a cross-country flight).

Regarding 2), even though a short-form like +1 seems reasonable, internally it should store no less than what git stores for a timezone, i.e. sign + hours and minutes. The Europe/Berlin example indicates that this form at least would already allow that.

  • Regarding 3), and like already mentioned in 2), it should be enough to store sign + hours + minutes to capture a timezone precisely enough. No timezone will just default to +0000 (like Git would see it).

Personally I see great benefit in storing dates the Git way, and somehow I consider it a solved problem especially if one wants to lean into what Git already provides. Of course, I have a Git bias, but recommend taking a look at gix-actor for producing and parsing timestamps.

As long as the timezone is stored per timestamp, and an event as start and end times, I think the data model should be fine for this case (and that's what I vaguely remember to being the case already).

from pace.

simonsan avatar simonsan commented on June 4, 2024

Considering Timezones

  1. Switch internal time representation to chrono::Utc for consistency.
  2. Implement input time conversion to UTC before storage.
  3. Convert UTC times to user's local time zone for display.
  4. Handle time zone switches gracefully by adjusting durations and display times accordingly. (e.g., when a task started in one time zone and ended in another)
  5. Investigate usage of chrono-tz for complex time zone rules.
  6. Add user-configurable time zone options in application settings.

from pace.

Byron avatar Byron commented on June 4, 2024

Thanks for setting up this issue, much appreciated!

Regarding timezones: I really like the proposal as I think it will work. One test I can think of is:

  • user starts task in timezone A
  • maybe more than a day passes
  • user ends task in timezone B

Something I also wonder about is if it would be good to store the timezone as well, just like Git does. That would allow the times to look natural, no matter from which timezone they are looked at. Think about me being in China for half a month, and in Germany another half. By the end of the month, I generate a timesheet for an invoice. If I am in Germany when doing it, it will look like I worked at night while logging time in China which isn't accurate. Clients might rightfully say that they are afraid of the quality produced by someone with insomnia ;).

So to catch this case, I think the timezone would also have to be stored to be able to store the local time of each task, with the possibility that start and stop are in different timezones.

from pace.

simonsan avatar simonsan commented on June 4, 2024

@Byron I'm sitting on it, but I need some better understanding from the user experience side and I would appreciate your help and ideas for this:

I want to do it in the way, that normally, people don't need to deal at all with timezone shenanigans.

  1. So as a first measurement, I will store a default timezone in the configuration file, which you can choose in the setup assistant that already exists with pace setup config. For us, this would be Europe/Berlin. I will further get the local offset from UTC and β€œguess” the countries you can decide from based on the offset in seconds to use these in the setup assistant's fuzzy select as higher priority, so they will appear closer to the cursor.

  2. As a second measurement, I'll introduce an optional command-line option to set the timezone or an offset from UTC for beginning and ending an activity. So that people have full control over it, even if they set something in their config. I imagine it like:

# short
alias tt = pace
tt b "My activity" -c "development::pace" -tzo +1
# -tzo should not be needed here, as that should be able to be determined
# automatically, but we should probably make it possible, to overwrite it

# or a bit longer
pace begin "My activity" -c "development::pace" -tz Europe/Berlin
pace begin "My activity" -c "development::pace" --tz-offset +1
  1. For the third measurement, the storage, I'm a bit unsure still. If we don't store the actual full time zone string, we lose out on information, which could be useful in the end. But as this is optional, and we cannot always determine it, it needs to be optional. The fallback will always be the automatically calculated tz-offset from local time.

Any feedback, if I have forgotten/overlooked anything for usability?

from pace.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.