2019-10-05 19:17:18 +00:00
|
|
|
<docs>
|
|
|
|
### Example
|
|
|
|
```vue
|
|
|
|
<DateCalendarIcon date="2019-10-05T18:41:11.720Z" />
|
|
|
|
```
|
|
|
|
|
|
|
|
```vue
|
|
|
|
<DateCalendarIcon
|
|
|
|
:date="new Date()"
|
|
|
|
/>
|
|
|
|
```
|
|
|
|
</docs>
|
|
|
|
|
2019-03-21 19:23:42 +00:00
|
|
|
<template>
|
2019-09-18 15:32:37 +00:00
|
|
|
<time class="datetime-container" :datetime="dateObj.getUTCSeconds()">
|
2019-03-21 19:23:42 +00:00
|
|
|
<span class="month">{{ month }}</span>
|
|
|
|
<span class="day">{{ day }}</span>
|
2019-04-03 15:29:03 +00:00
|
|
|
</time>
|
2019-03-21 19:23:42 +00:00
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
|
|
|
|
|
|
|
@Component
|
2019-04-03 15:29:03 +00:00
|
|
|
export default class DateCalendarIcon extends Vue {
|
2019-10-05 19:17:18 +00:00
|
|
|
/**
|
|
|
|
* `date` can be a string or an actual date object.
|
|
|
|
*/
|
2019-03-21 19:23:42 +00:00
|
|
|
@Prop({ required: true }) date!: string;
|
|
|
|
|
|
|
|
get dateObj() {
|
2019-04-03 15:29:03 +00:00
|
|
|
return new Date(this.$props.date);
|
2019-03-21 19:23:42 +00: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 15:32:37 +00:00
|
|
|
time.datetime-container {
|
2019-04-03 15:29:03 +00: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 11:03:48 +00:00
|
|
|
width: 50px;
|
2019-04-03 15:29:03 +00:00
|
|
|
padding: 8px;
|
|
|
|
text-align: center;
|
2019-03-21 19:23:42 +00:00
|
|
|
|
|
|
|
span {
|
2019-04-03 15:29:03 +00:00
|
|
|
display: block;
|
2020-02-18 07:47:41 +00:00
|
|
|
font-weight: 600;
|
2019-03-21 19:23:42 +00:00
|
|
|
|
|
|
|
&.month {
|
|
|
|
color: #fa3e3e;
|
|
|
|
padding: 2px 0;
|
|
|
|
font-size: 12px;
|
|
|
|
line-height: 12px;
|
2019-04-03 15:29:03 +00:00
|
|
|
text-transform: uppercase;
|
2019-03-21 19:23:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
&.day {
|
|
|
|
font-size: 20px;
|
|
|
|
line-height: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|