2019-10-05 21:17:18 +02:00
|
|
|
<docs>
|
|
|
|
### Example
|
|
|
|
```vue
|
|
|
|
<DateCalendarIcon date="2019-10-05T18:41:11.720Z" />
|
|
|
|
```
|
|
|
|
|
|
|
|
```vue
|
|
|
|
<DateCalendarIcon
|
|
|
|
:date="new Date()"
|
|
|
|
/>
|
|
|
|
```
|
|
|
|
</docs>
|
|
|
|
|
2019-03-21 20:23:42 +01:00
|
|
|
<template>
|
2019-09-18 17:32:37 +02:00
|
|
|
<time class="datetime-container" :datetime="dateObj.getUTCSeconds()">
|
2019-03-21 20:23:42 +01:00
|
|
|
<span class="month">{{ month }}</span>
|
|
|
|
<span class="day">{{ day }}</span>
|
2019-04-03 17:29:03 +02:00
|
|
|
</time>
|
2019-03-21 20:23:42 +01:00
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
|
|
|
|
|
|
|
@Component
|
2019-04-03 17:29:03 +02:00
|
|
|
export default class DateCalendarIcon extends Vue {
|
2019-10-05 21:17:18 +02:00
|
|
|
/**
|
|
|
|
* `date` can be a string or an actual date object.
|
|
|
|
*/
|
2019-03-21 20:23:42 +01:00
|
|
|
@Prop({ required: true }) date!: string;
|
|
|
|
|
|
|
|
get dateObj() {
|
2019-04-03 17:29:03 +02:00
|
|
|
return new Date(this.$props.date);
|
2019-03-21 20:23:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
get month() {
|
|
|
|
return this.dateObj.toLocaleString(undefined, { month: 'short' });
|
|
|
|
}
|
|
|
|
|
|
|
|
get day() {
|
|
|
|
return this.dateObj.toLocaleString(undefined, { day: 'numeric' });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2019-09-18 17:32:37 +02:00
|
|
|
time.datetime-container {
|
2019-04-03 17:29:03 +02:00
|
|
|
background: #f6f7f8;
|
|
|
|
border: 1px solid rgba(46,62,72,.12);
|
|
|
|
border-radius: 8px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
/*height: 50px;*/
|
2019-10-14 13:03:48 +02:00
|
|
|
width: 50px;
|
2019-04-03 17:29:03 +02:00
|
|
|
padding: 8px;
|
|
|
|
text-align: center;
|
2019-03-21 20:23:42 +01:00
|
|
|
|
|
|
|
span {
|
2019-04-03 17:29:03 +02:00
|
|
|
display: block;
|
2019-03-21 20:23:42 +01:00
|
|
|
|
|
|
|
&.month {
|
|
|
|
color: #fa3e3e;
|
|
|
|
padding: 2px 0;
|
|
|
|
font-size: 12px;
|
|
|
|
line-height: 12px;
|
2019-04-03 17:29:03 +02:00
|
|
|
text-transform: uppercase;
|
2019-03-21 20:23:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
&.day {
|
|
|
|
font-weight: 300;
|
|
|
|
font-size: 20px;
|
|
|
|
line-height: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|