Weirdly enough there isnt a way to have today's date and time as default for a Storyblok DateTime field... So I created one.
Weirdly enough there isnt a way to have today's date and time as default for a Storyblok DateTime field... So I created one.
const Fieldtype = { | |
template: ` | |
<div> | |
<div class="image__wrap uk-margin-small-bottom"> | |
<input type="datetime-local" id="date" name="date" v-model="model.date"> | |
</div> | |
</div> | |
`, | |
mixins: [window.Storyblok.plugin], | |
methods: { | |
initWith() { | |
return { | |
plugin: 'date-time-today-default', | |
date: new Date().toISOString(), | |
} | |
}, | |
pluginCreated() { | |
console.log('plugin:created') | |
} | |
}, | |
watch: { | |
'model': { | |
handler: function (value) { | |
this.$emit('changed-model', value); | |
}, | |
deep: true | |
} | |
} | |
} |