[READ-ONLY] a fast, modern browser for the npm registry
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: don't rely on pkg.updated for update date (#561)

authored by

Wojciech Maj and committed by
GitHub
8081bb6a f8ee1c31

+5 -8
+1 -2
app/components/PackageTableRow.vue
··· 17 17 const pkg = computed(() => props.result.package) 18 18 const score = computed(() => props.result.score) 19 19 20 - // Get the best available date: prefer result.updated (from packument), fall back to package.date 21 - const updatedDate = computed(() => props.result.updated ?? props.result.package.date) 20 + const updatedDate = computed(() => props.result.package.date) 22 21 23 22 function formatDownloads(count?: number): string { 24 23 if (count === undefined) return '-'
+2 -4
app/composables/useStructuredFilters.ts
··· 225 225 const config = UPDATED_WITHIN_OPTIONS.find(o => o.value === within) 226 226 if (!config?.days) return true 227 227 228 - const updatedDate = new Date(pkg.updated ?? pkg.package.date) 228 + const updatedDate = new Date(pkg.package.date) 229 229 const cutoff = new Date() 230 230 cutoff.setDate(cutoff.getDate() - config.days) 231 231 return updatedDate >= cutoff ··· 260 260 diff = (a.downloads?.weekly ?? 0) - (b.downloads?.weekly ?? 0) 261 261 break 262 262 case 'updated': 263 - diff = 264 - new Date(a.updated ?? a.package.date).getTime() - 265 - new Date(b.updated ?? b.package.date).getTime() 263 + diff = new Date(a.package.date).getTime() - new Date(b.package.date).getTime() 266 264 break 267 265 case 'name': 268 266 diff = a.package.name.localeCompare(b.package.name)
+2 -2
app/pages/~[username]/index.vue
··· 106 106 switch (sortOption.value) { 107 107 case 'updated': 108 108 pkgs.sort((a, b) => { 109 - const dateA = a.updated || a.package.date || '' 110 - const dateB = b.updated || b.package.date || '' 109 + const dateA = a.package.date || '' 110 + const dateB = b.package.date || '' 111 111 return dateB.localeCompare(dateA) 112 112 }) 113 113 break