Skip to content

converted time data to local timezone #6

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

Merged
merged 3 commits into from
Aug 20, 2021
Merged

converted time data to local timezone #6

merged 3 commits into from
Aug 20, 2021

Conversation

TheTrio
Copy link
Contributor

@TheTrio TheTrio commented Aug 15, 2021

Issue: #4

So unfortunately, I couldn't find a way to seed the database(maybe I missed it in the README) but I tried this with a dummy array and it seems to work.

@SysSn13
Copy link
Owner

SysSn13 commented Aug 16, 2021

This is not working as intended because you are converting the time on the server side. What we need is to covert the time to the client's time zone. Converting this in ejs template will also not help as templates are also compiled on the server-side.

@TheTrio
Copy link
Contributor Author

TheTrio commented Aug 16, 2021

How about this? I'm changing the startTime td on the client side now.

@TheTrio
Copy link
Contributor Author

TheTrio commented Aug 16, 2021

Actually, on second thought, let startTime = new Date(contest.textContent) ought to be enough since the Date constructor defaults to the local timezone. I haven't been able to confirm this though, given that my local server and my browser are in the same time zone.

@SysSn13
Copy link
Owner

SysSn13 commented Aug 20, 2021

Not working when entries are more than the pagination page size. Also what is the need of using Intl when you can simply use Date.prototype.toLocaleString()?

@SysSn13
Copy link
Owner

SysSn13 commented Aug 20, 2021

You can populate the database by running the background service and changing IsLatestContest accordingly.

@TheTrio
Copy link
Contributor Author

TheTrio commented Aug 20, 2021

So I have fixed the pagination bug by running the code when the page is changed. As for the timezone, I've removed the redundant parts. Hopefully this suffices. Do let me know if there's anything I can do better.

@SysSn13
Copy link
Owner

SysSn13 commented Aug 20, 2021

Seems good.

@SysSn13 SysSn13 merged commit 32a8151 into SysSn13:main Aug 20, 2021
@SysSn13 SysSn13 linked an issue Aug 20, 2021 that may be closed by this pull request
@TheTrio TheTrio deleted the localTimezones branch August 21, 2021 20:07
SysSn13 pushed a commit that referenced this pull request Jan 30, 2024
* converted time data to local timezone

* Convert time on client-side instead of server-side

* Fixed pagination bug
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.

Show contest time in local timezone
2 participants