How can I have year input only?
I have this date input below which gives me dates from 2014-10-01,
dateInput(
inputId = "date_from",
label = "Select time period:",
value = "2014-10-01",
format = "dd-mm-yyyy"
)
But I don't need the months and dates, only years that I need,
dateInput(
inputId = "year_from",
label = "Select time period:",
value = "2014",
format = "yyyy"
)
It does not work obviously as I still see the months and dates being displayed.
Any ideas?
If you don't need months and days, then I'd argue that what you want is not dates but just year. If you just want year, then I would use a selectInput instead of a dateInput. Usually dateInput are used when you literally want a full date, but it makes a lot more sense to just show a select box with years if that's all you need. It's also a lot easier for the user to use from a user-experience point of view.
selectInput(
inputId = "date_from",
label = "Select time period:",
choices = 2014:2100
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With