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

Humanized time for metadata summary ui page does not seem to work #8409

Open
wangf1122 opened this issue Oct 8, 2024 · 3 comments
Open

Humanized time for metadata summary ui page does not seem to work #8409

wangf1122 opened this issue Oct 8, 2024 · 3 comments

Comments

@wangf1122
Copy link
Collaborator

This issue can be verified from the current GN4 deployment https://apps.titellus.net/geonetwork/srv/eng/catalog.search#/metadata/da3a37ec-863f-40be-8606-0263f75a7511

I have turn off the humanized time from ui setting.

image

I can verify from my Edge browser's debug tool. The configuration does passed into the Javascript
image

var settingAllowToUseFromNow = gnGlobalSettings.gnCfg.mods.global.humanizeDates,

However. these two return statements do exactly the same thing

if (settingAllowToUseFromNow && contextAllowToUseFromNow) {
return {
value: fromNow,
title: format ? parsedDate.format(format) : parsedDate.toString()
};
} else {
return {
title: fromNow,
value: format ? parsedDate.format(format) : parsedDate.toString()

And they always return title as fromNow and value as converted time instead of original.
image

In our case, we are using the HNAP schema. It has further zoned information, we want to show the original unconverted time in the title popup instead of converted time.

image

@ianwallen ianwallen changed the title Humanized time for metadata summary ui page Humanized time for metadata summary ui page does not seem to work Oct 8, 2024
@ianwallen
Copy link
Contributor

@wangf1122
PR #8365 has some changes that may help address this issue.

@wangf1122
Copy link
Collaborator Author

@wangf1122 PR #8365 has some changes that may help address this issue.

@ianwallen

I have brought that pull request change into my local. Its not working. I don't think they are relevant. The issue is this ui module

<span data-gn-humanize-time="{{range.end.date}}"></span>

data-gn-humanize-time. In this case, the {{range.end.date}} is passed to the ui module with zone information. For some reason, this ui module decided to convert it to UTC which may confuse the user. It is probably make sense. But the only issue is the popup windows have the option to use original date or fromNow date.

If I change the logic to have like this in the else statement.

image

Things will work as expect to disallow fromNow

image

To me, it is a bug in this ui module. I can make a simple pull request to fix it

@wangf1122
Copy link
Collaborator Author

@ianwallen @josegar74

The provided pull request will probably fix citation/gmd:date. But it will not fix identification/.../beginPosition and endPosition in this issue. I checked pretty much every schema indexing calls this function

<xsl:param name="start" as="node()?"/>
<xsl:param name="end" as="node()?"/>

which obtained the node of beginPosition and endPosition. So we probably should do some zone ignoring thing here. Or I suggest we can do it within the ui module with some special UI configuration to skip the UTC conversion here.

parsedDate = moment(date, "YYYY-MM-DDtHH-mm-SSSZ");
} else {
parsedDate = moment(date);

Any idea?

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

No branches or pull requests

2 participants