Skip to content

Instantly share code, notes, and snippets.

@zmts
Last active February 16, 2018 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmts/4d4cb7ddb6c7107faeb84256b0c951c3 to your computer and use it in GitHub Desktop.
Save zmts/4d4cb7ddb6c7107faeb84256b0c951c3 to your computer and use it in GitHub Desktop.
datetime, vuejs

vue-datetime

https://github.com/mariomka/vue-datetime

<Datetime
  :format="dateTimeFormat"
  :min-datetime="datesToDisable"
  auto
  v-model="deadline"
  type="datetime">
</Datetime>
import { Datetime } from 'vue-datetime';
import { DateTime } from 'luxon';

computed: {
  deadline: {
    get () {
      return this.item.deadline.date ? this.$moment(this.item.deadline.date).toISOString() : (new Date()).toISOString();
    },
    set (date) {
      this.item.deadline.date = date;
    }
  },
  dateTimeFormat () {
    return DateTime.DATETIME_SHORT;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment