F
F
fisherspoons2021-09-21 21:42:20
Vue.js
fisherspoons, 2021-09-21 21:42:20

How to return both dates in input?

I use v-calendar , I'm interested in the question of how to return both dates when choosing a period in one input, in the form 02/01/2021 - 02/02/2021

https://codesandbox.io/s/keen-engelbart-6dyk5?file...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2021-09-21
@fisherspoons

const DTF = new Intl.DateTimeFormat('ru-RU');

export default {
  name: "App",
  data() {
    return {
      dateRange: { start: new Date(), end: new Date() },
    };
  },
  computed: {
    display_value() {
      return [this.dateRange.start, this.dateRange.end].map(DTF.format).join(" - ");
    }
  },
};

and output to :valuethis display_value.
https://codesandbox.io/s/wizardly-pateu-8rn6h?file...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question