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

[Tech-Debt] Use luxon for user deletion calculation #6843

Closed
jrasm91 opened this issue Feb 2, 2024 · 5 comments
Closed

[Tech-Debt] Use luxon for user deletion calculation #6843

jrasm91 opened this issue Feb 2, 2024 · 5 comments
Assignees
Labels

Comments

@jrasm91
Copy link
Contributor

jrasm91 commented Feb 2, 2024

user.service.ts#isReadyForDeletion uses Date millisecond parsing, but should use luxon, for a much cleaner implementation.

    // TODO use luxon for date calculation
    const msInDay = 86_400_000;
    const msDeleteWait = msInDay * 7;
    const msSinceDelete = Date.now() - (Date.parse(user.deletedAt.toString()) || 0);

    return msSinceDelete >= msDeleteWait;
@manasadepu
Copy link
Contributor

Hey, first time contributor here. Can I take this issue?

@manasadepu
Copy link
Contributor

`import { DateTime } from 'luxon';
const msDeleteWait = 7 * 24 * 60 * 60 * 1000;
const deletedAt = DateTime.fromJSDate(user.deletedAt || new Date(0));
const msSinceDelete = DateTime.now().diff(deletedAt).as('milliseconds');

return msSinceDelete >= msDeleteWait;`

@manasadepu
Copy link
Contributor

manasadepu commented Feb 3, 2024

This is my idea for the solution, would this be considered concise enough?

@jrasm91
Copy link
Contributor Author

jrasm91 commented Feb 3, 2024

Feel free to open a pull request to discuss it

@danieldietzler
Copy link
Member

Done in #6958

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants