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

How to set date&time value which is coming from api to this vuetify-datetime picker, which i was using in vue-datatable #102

Open
praneeth-gone opened this issue Feb 12, 2022 · 1 comment

Comments

@praneeth-gone
Copy link

No description provided.

@praneeth-gone praneeth-gone changed the title How to set date&time value which is coming from api to this vuetify-datetime picker How to set date&time value which is coming from api to this vuetify-datetime picker, which i was using in vue-dtatable Feb 13, 2022
@praneeth-gone praneeth-gone changed the title How to set date&time value which is coming from api to this vuetify-datetime picker, which i was using in vue-dtatable How to set date&time value which is coming from api to this vuetify-datetime picker, which i was using in vue-datatable Feb 14, 2022
@AIjbillinger
Copy link

just in case you're still looking for an answer

  • set dateFormat and timeFormat in the v-datetime-picker element
  • after you API call reformat the timestamp to your desired format before writing it to the v-model of your v-datetime-picker
  • I'm using moment to format timestamps, less issues than splitting the timestamp a bunch of times.
<v-datetime-picker
      label="start"
      v-model="campaign.start"
      dateFormat="dd.MM.yyyy"
      timeFormat="HH:mm"
...

// api call
let campaign = response.data.campaign;
campaign.start = moment(campaign.start_date).format('DD.MM.YYYY HH:mm');
this.campaign = campaign;

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

No branches or pull requests

2 participants