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

Fix different displayed date #315

Merged
merged 2 commits into from
Dec 23, 2023

Conversation

Xpirix
Copy link
Collaborator

@Xpirix Xpirix commented Nov 28, 2023

This fix is for the following issue:

In the current PR, all dates in the plugin list, the plugin details and the plugin version details use the same timezone provided by the filter local_timezone.
In the plugin list, the date without time format is kept. A distance formatting (time since) using moment.min.js is used when it doesn't exceed one day.

Please find below the screenshots for these 3 pages:

image

image

image

@Xpirix Xpirix requested a review from dimasciput November 28, 2023 13:25
@Xpirix
Copy link
Collaborator Author

Xpirix commented Nov 30, 2023

Please find below the updated screenshot after fixing the displayed date in the 'Created on' column:
image

@agiudiceandrea
Copy link
Contributor

@Xpirix, thanks for looking at the issue! It is not clear to me why the "Created on" column displays "Nov 30, 2023" while the plugin has been created on "Nov 28, 2023".

@Xpirix
Copy link
Collaborator Author

Xpirix commented Dec 2, 2023

@agiudiceandrea , Thanks for your feedback. Indeed, the plugin was uploaded on different dates in my development environment but I did not update all screenshots. Please find below the updated screenshots for all of these pages for a newly uploaded plugin:

image

image

image

@dimasciput dimasciput merged commit 6fe3124 into qgis:master Dec 23, 2023
2 checks passed
@Xpirix
Copy link
Collaborator Author

Xpirix commented Dec 26, 2023

@dimasciput Thank you.
I checked the plugin list but I noticed that the dates are in a raw format. I see that the file local_timezone.js used in the browser is different from the one in the code. I cleared my cache but still got the same format. However, the right file is implemented in the server.

image

@agiudiceandrea
Copy link
Contributor

I checked the plugin list but I noticed that the dates are in a raw format

I can confirm the issue.
The local_timezone.js (https://plugins.qgis.org/static/js/local_timezone.js) retrieved from the server is the old one:

// Replace the date with local timezone

$(".user-timezone").each(function (i) {
  let localDate = toUserTimeZone($(this).text());
  $(this).text(localDate);
})

function toUserTimeZone(date) {
  try {
    date = new Date(date);
    let options = {
      year: 'numeric', month: 'short', day: 'numeric',
      hour: '2-digit', minute: '2-digit',
      timeZoneName: 'short'
    }
    return date.toLocaleDateString([], options);
  } catch (e) {
    return date;
  }
}

The response headers report: last-modified: Thu, 08 Sep 2022 18:59:37 GMT.

Maybe a cloudflare cache issue?

@agiudiceandrea
Copy link
Contributor

I can confirm the issue.

The issue has been fixed with #335.

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.

3 participants