-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
navbar_alerts: Convert module to TypeScript. #30123
base: main
Are you sure you want to change the base?
Conversation
web/src/navbar_alerts.ts
Outdated
const deadline = new Date(realm.demo_organization_scheduled_deletion_date * 1000); | ||
export function get_demo_organization_deadline_days_remaining(): number { | ||
const now = Date.now(); | ||
const deadline = new Date(realm.demo_organization_scheduled_deletion_date! * 1000).getTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove this code and just use realm.demo_organization_scheduled_deletion_date! * 1000
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the question? Or the choice to remove the new Date()
wrapper?
Oh, is the idea that we'd just be subtracting UNIX timestamps?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I meant. Should we do that, or is this just fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Subtracting UNIX timestamps seems fine. But I don't like doing that in the same commit as the TS migration; it is very hard to check, and it seems like there's logic changes in multiple places in this file around adding/removing getTime
calls. So maybe you can split that to a prep commit or follow-up commit to make those logic changes easier to review?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What justifies the unchecked !
? There’s nothing that would prevent someone from changing code elsewhere to call this function while realm.demo_organization_scheduled_deletion_date
is undefined, so this is not locally safe. Use assert
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
The cancelled check seems unrelated. |
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: