Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set time via props #28

Open
sebsobseb opened this issue Aug 31, 2020 · 3 comments
Open

Set time via props #28

sebsobseb opened this issue Aug 31, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@sebsobseb
Copy link
Contributor

Hi,

Right now, when you select a date, the time is always the current time. This is fine in the majority of the cases.
But, I think it would be useful if we could set the time of the date that is emitted to v-model.

Context: I have a project where we have a lot of datepickers for "from" and "until" dates.
We always want to force the time of "from" dates to 00:00:00 and "until" dates to 23:59:59. Currently we always have to modify it after the date was picked.
This feature would be pretty handy for this 🥇

Here are my 2 proposals:

  • Have 1 optional prop named set-time, which would accept a string in format HH:MM:SS
  • Have 3 optional props, one for each unit:
    • set-hours, which would accept an integer from 0 to 23.
    • set-minutes, which would accept an integer from 0 to 59.
    • set-seconds, which would accept an integer from 0 to 59.

Thanks!

@MrWook
Copy link
Collaborator

MrWook commented Sep 4, 2020

Hm i see your point but this isn't just "set the time to xy" because the datepicker can distinguishes between utc and the local timezone.
If you use the utc prop the model of your datepicker can be different from what the picked date actual is.
For example if you select 2020-08-01 and you are in a timezone before utc like somewhere in america with CDT which is -5 the model of the date would be 2020-07-31T19:00:00.

@MrWook MrWook added the enhancement New feature or request label Sep 4, 2020
@sebsobseb
Copy link
Contributor Author

@MrWook Ok, good point. Is it an option to only make it work when you don't use the utc prop?

@djixadin
Copy link

There is something wrong with this. The input and selected events are emitting a date with no time. Am i doing something wrong or is that new intended behavior

image

using latest version at this time: 3.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants