Go Behind the Experience to see how Tecovas brings the West to life with Sanity 🤠 July 18th

Custom time-only input for localized project in Sanity.io

3 replies
Last updated: Jun 23, 2024
Hey community, I was wondering, there are the
Date and Datetime SchemaTypes. What about time only? Yes, there is the great Availability Plugin but in my localized project I need to control the output of time format which I could not solve. Anyone experienced to create a custom time only input? Thanks a lot!!!
Jun 23, 2024, 12:15 PM
I used this one for mine: https://www.sanity.io/guides/create-a-time-duration-object-field
It worked pretty well and while I didn't need duration every time it allowed for time as a string I believe which could then be added to a datetime field if needed.
Jun 23, 2024, 3:24 PM
it should at least give you the framework to modify this one to what you might need.
Jun 23, 2024, 3:25 PM
Yeah, Thank you, looks good to me, just need to loacalize the output.
Jun 23, 2024, 10:26 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?