Dropdown of years

Hello,

I’d like to create a dropdown that enables to select a year (e.g. 2027, 2032, etc.).
image
For now, I use the date and time picker from Weweb but don’t know how to set it up so that the user does not need to select in addition to the year, a given month and day (e.g. 2027 July 8th) which are not relevant to my case.

Would anyone have an idea?

Thank you!

Don’t use a date and time picker. Just use a regular dropdown with all the dates you want the user to pick from. Then it will show up in a single list with only one list to (year) to select from.

Thank you! Question:

Will the backend recognize the format ? i.e. year 2025 is converted to a timestamp on Xano, if I’m not mistaken

Hi @SnitchNewt
I did this:
image

Problem is these are not recognized as years and I need it to be to do other manipulations. Is it possible to transform this data to years?

thanks

A “date” timestamp will always contain years, months, day, hours, minutes, and seconds. You definitely created a dropdown with 4-digit years represented as a number.

Your new problem is that these 4-digit numbers are not being recognized as “years”. We will need more context or understanding of how you are using these values and processing them. If you can give more specific details of your application and what these years are used for, then we can offer other suggestions.

For example, are these years that a vehicle was manufactured? Then a 4-digit number would suffice without it being represented as a date. What calculation are you trying to do based on this 4-digit number?

Hi @SnitchNewt

Thank you for your answer. Actually, I explored again the functionality and found out that it’s possible to setup the date and time picker to show only years so the problem is solved.

For those who encounter the same issue, here is what you need to do

  1. Select the parent element
    image
  2. Under the menu “Time”, select year.
  3. Under “Specific”, select the “Custom” format and enter the year “YYYY” format.
    image

Tada - it works !

1 Like