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

block: console warning "Invalid Morebits.date initialisation" when picking certain durations such as 3 hours #2105

Open
NovemLinguae opened this issue Dec 6, 2024 · 2 comments
Labels

Comments

@NovemLinguae
Copy link
Member

NovemLinguae commented Dec 6, 2024

Steps to reproduce

  • be an admin
  • visit a test user's talk page
  • open the block module
  • have DevTools console open
  • select 3 hours for block duration
  • submit

What happens?

  • Invalid Morebits.date initialisation: ['3 hours']
image

What should have happened instead?

  • No console warning

Notes

  • First seen when using the block module and selecting 3 hours as the block duration. Doesn't appear to cause any bugs, but throws this console warning before the page refreshes.
  • Not a result of recent refactorings. Still happens using a commit from a month ago.
@siddharthvp
Copy link
Member

Well, '3 hours' is an invalid date, so the warning is correct. It results in NaN if you try to retrieve any time elements.

Screenshot 2024-12-21 at 8 06 07 PM

@NovemLinguae NovemLinguae changed the title morebits: console warning "Invalid Morebits.date initialisation" block: console warning "Invalid Morebits.date initialisation" when picking certain durations such as 3 hours Dec 21, 2024
@NovemLinguae
Copy link
Member Author

Looks like I should refocus this ticket on the block module rather than the morebits library. Done.

Looks like the block module is trying to initialize a relative time (3 hours) rather than an absolute time (December 21, 2024 @ 6AM) like it's supposed to.

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

2 participants