Skip to content

Added last updated time for OH#100

Merged
notkaramel merged 3 commits intomainfrom
origin/karen/last_updated
Feb 9, 2026
Merged

Added last updated time for OH#100
notkaramel merged 3 commits intomainfrom
origin/karen/last_updated

Conversation

@Karencheenn
Copy link
Contributor

Related to #91

  • I've created a field _lastUpdated by querying the updatedAt field and reordering it.
  • Added at the last updated time at the top of OH.

@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ecsess Ready Ready Preview, Comment Feb 9, 2026 8:28pm

Copy link
Member

@notkaramel notkaramel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! We will keep a similar framework for other pages soon!

"logo": logo.asset->url+"?h=100&fm=webp"
}
},
"_lastUpdated": *[_type=="officeHours"] | order(_updatedAt desc)[0]._updatedAt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're renaming the variable, you can change "_lastUpdated" to a more descriptive name. I suggest "ohLastUpdated" and also put it between Line 17 and 18 so it's next to the fetching OH query.

"officeHours": *[_type=="officeHours"]{
day,
startTime,
endTime,
"member": {
"name": member->name,
"position": member->position
}
},
"sponsors": *[_type=="sponsors"]{

Great use of the pipe/order functions! I didn't know Sanity can do that

sponsors: sponsorsResp,
canonical: url.href
canonical: url.href,
ohLastUpdated: homePageResp._lastUpdated ?? null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can do the time formatting/casting on the backend (this .server file)?

// What you currently have on the frontend
{new Date(data.ohLastUpdated).toLocaleString()} 

// What I'm thinking the frontend should have
{data.ohLastUpdated}

Functionality wise it's the same, but the frontend just have to get the value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that i've been doubting.. how to do formatting from the backend, u could check the newest version rn

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a line that creates new Date() after getting the homePageRepsonse, and return the value in the return block.

By "backend" I meant the page.server.ts file, sorry for the confusion

@notkaramel notkaramel merged commit 680a6a6 into main Feb 9, 2026
4 checks passed
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.

2 participants