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

feat: granular office hours #312

Merged
merged 14 commits into from
Aug 29, 2024
Merged

feat: granular office hours #312

merged 14 commits into from
Aug 29, 2024

Conversation

gzeoneth
Copy link
Collaborator

No description provided.

uint256 public immutable maxLocalHour;

/// @notice The offset from UTC to local time. e.g. -5 for EST, -4 for EDT
int256 public immutable localHourOffset;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont like having the offset, working in relative time zones is pretty annoying. Would rather it was all UTC

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All UTC doesn't work well with time wrapping midnight unless we use a 48 hours notation or some conditional depending on if start < end.

Having the offset is also easier for most people to read imo.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh, I guess in most cases this will be fine, the only case it wont be is when we want to cross midnight. Then the caller will need to set some random timezone

src/gov-action-contracts/util/OfficeHoursAction.sol Outdated Show resolved Hide resolved
src/gov-action-contracts/util/OfficeHoursAction.sol Outdated Show resolved Hide resolved
src/gov-action-contracts/util/OfficeHoursAction.sol Outdated Show resolved Hide resolved
uint256 public immutable maxLocalHour;

/// @notice The offset from UTC to local time. e.g. -5 for EST, -4 for EDT
int256 public immutable localHourOffset;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh, I guess in most cases this will be fine, the only case it wont be is when we want to cross midnight. Then the caller will need to set some random timezone

@gzeoneth gzeoneth merged commit 1fc24ee into office-hours-actions Aug 29, 2024
8 checks passed
@godzillaba godzillaba deleted the g-office-hour branch August 29, 2024 12:45
gzeoneth added a commit that referenced this pull request Sep 11, 2024
* office hours action

* ...

* feat: granular office hours (#312)

* feat: granular office hours

* format: forge fmt

* refactor: custom errors

* fix: casting

* test: OfficeHoursActionTest

* format: forge fmt

* docs: comments

* docs: comment fix

* fix: weekday math

* doc: fix typo

* docs: add utc comment

* docs: wording

* chore: update gas snapshot

* fix: localTimestamp for week of day

* test: local time edge cases

* format: forge fmt

* chore: update gas snapshot

---------

Co-authored-by: gzeon <[email protected]>
Co-authored-by: gzeon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants