daterange to my own styled date
With using daterange I am getting an array of two dates
{{ value[0] }}
It is giving me like this:
Thu Dec 19 2019 00:00:00 GMT+0600 (Bangladesh Standard Time)
But I want to print it in my style. Like
November 26, 2019 and December 26, 2019.
Working with Element:
https://element.eleme.io/#/en-US/component/date-picker
@nakov,
January, February, March etc
May be I need to hard code it with Javascript.
Here is not solution for it.
@nafeeur10 no you don't need to hard-code it.. You just need the right format: MMMM will give you just that.
You need to add: format="MMMM d, yyyy" on the element.
@nakov,
Okay. It is working on daterange input but in output ({{ value[0] }}) it is giving the same as I posted.
@nafeeur10 can you show me how do you get the date from the database? You will have to change the format there too. On the Carbon instance.
@nakov
<template>
<div class="block">
<p>Component value:{{ value }}</p>
<el-date-picker
v-model="value"
type="daterange"
start-placeholder="Start date"
end-placeholder="End date">
</el-date-picker>
</div>
</template>
<script>
export default {
data() {
return {
value: ''
};
}
};
</script>
I am not using database yet. It's from vue.
@nafeeur10 but you've tried adding the format?
<el-date-picker
v-model="value"
type="daterange"
start-placeholder="Start date"
format="MMMM d, yyyy"
end-placeholder="End date">
</el-date-picker>
?
@nakov,
Tried with your. But same result in output. After selecting two dates.
Thu Dec 19 2019 00:00:00 GMT+0600
@nafeeur10 every datepicker selector that shows this format, must have this attribute:
format="MMMM d, yyyy"
Otherwise it will show a default value.
Please or to participate in this conversation.