You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SeverusYixin
changed the title
Improve the accuracy of the filter card —— publication date
Improve the accuracy of the filter card —— publication date(materials Page)
Nov 14, 2024
SeverusYixin
changed the title
Improve the accuracy of the filter card —— publication date(materials Page)
Improve the accuracy of the filter card_V1 —— publication date(materials Page)
Nov 14, 2024
if (source.publication_date) {
const year = source.publication_date.toString().split('-')[0];
publicationDates[year] = (publicationDates[year] || 0) + 1;
}
In materials page:
if (item.publication_date) {
let year;
if (typeof item.publication_date === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(item.publication_date)) {
year = parseInt(item.publication_date.split('-')[0], 10);
} else if (typeof item.publication_date === 'string' && /^\d{4}$/.test(item.publication_date)) {
year = parseInt(item.publication_date, 10);
} else if (typeof item.publication_date === 'number') {
year = item.publication_date; // If the year is provided as a number
}
if (year && year >= 1900 && year <= new Date().getFullYear()) {
publicationDates[year] = (publicationDates[year] || 0) + 1;
minYear = Math.min(minYear, year);
maxYear = Math.max(maxYear, year);
}
The accuracy issue with the filter cards: the number displayed in the top right corner does not match the actual count.
The text was updated successfully, but these errors were encountered: