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

configurable end/start of day #3

Open
masukomi opened this issue Dec 17, 2022 · 1 comment
Open

configurable end/start of day #3

masukomi opened this issue Dec 17, 2022 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@masukomi
Copy link
Owner

It'd be nice to be able to configure things, such as when the start of the day is. Many of us work past midnight, and consider it part of the prior day's work. So, it'd be nice to have the logging use our preferred "start of day" time.

There should be a config file in $XDG_CONFIG_HOME/hey/config.toml (or similar) that allows users to specify that time. I think that file should probably be TOML, but am open to suggestions. Just not YAML because way too many developers hate YAML. :/

@masukomi masukomi added enhancement New feature or request good first issue Good for newcomers labels Dec 17, 2022
@masukomi
Copy link
Owner Author

masukomi commented Jan 4, 2023

Just realized that a nice way to handle this is to

  1. limit choice to an even hour. E.g. 4 AM not 4:44 AM
  2. whenever doing calculations for reporting purposes just have them run within a time zone that corresponds to the requested hour.

That is to say, if i'm in Eastern Standard Time and I set my "end/start of day" to 4 am then behind the scenes, and only for the purposes of finding day/week/month boundaries, change my time zone from GMT -5 (EST) to GMT -9 (AKST). Midnight AKST is 4AM EST. Once we've done that we can leverage all of Raku's built in day/month functionality without doing any funky math & custom day boundary calculations everywhere.

a simple example: hey log 3 days

  1. read in config for start/end of day
  2. see that it's 4 hours off and add +4 to current time zone.
  3. calculate the start of the day 3 days ago.
  4. get that as an epoch time.
    (at this point we're done mucking with the fake time zone)
  5. query the db for entries from that time forward
  6. pass the results on for reporting
    user output works as it already does with the current time zone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant