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>
|
2020-02-18 07:57:00 +00:00
|
|
|
<time class="datetime-container" :datetime="dateObj.getUTCSeconds()">
|
|
|
|
<span class="month">{{ month }}</span>
|
|
|
|
<span class="day">{{ day }}</span>
|
|
|
|
</time>
|
2019-03-21 19:23:42 +00:00
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
2020-02-18 07:57:00 +00:00
|
|
|
import { Component, Prop, Vue } from "vue-property-decorator";
|
2019-03-21 19:23:42 +00:00
|
|
|
|
|
|
|
@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() {
|
2020-02-18 07:57:00 +00:00
|
|
|
return this.dateObj.toLocaleString(undefined, { month: "short" });
|
2019-03-21 19:23:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get day() {
|
2020-02-18 07:57:00 +00:00
|
|
|
return this.dateObj.toLocaleString(undefined, { day: "numeric" });
|
2019-03-21 19:23:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2020-02-18 07:57:00 +00:00
|
|
|
time.datetime-container {
|
|
|
|
background: #f6f7f8;
|
|
|
|
border: 1px solid rgba(46, 62, 72, 0.12);
|
|
|
|
border-radius: 8px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
/*height: 50px;*/
|
|
|
|
width: 50px;
|
|
|
|
padding: 8px;
|
|
|
|
text-align: center;
|
2019-03-21 19:23:42 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
span {
|
|
|
|
display: block;
|
|
|
|
font-weight: 600;
|
2019-03-21 19:23:42 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
&.month {
|
|
|
|
color: #fa3e3e;
|
|
|
|
padding: 2px 0;
|
|
|
|
font-size: 12px;
|
|
|
|
line-height: 12px;
|
|
|
|
text-transform: uppercase;
|
|
|
|
}
|
2019-03-21 19:23:42 +00:00
|
|
|
|
2020-02-18 07:57:00 +00:00
|
|
|
&.day {
|
|
|
|
font-size: 20px;
|
|
|
|
line-height: 20px;
|
2019-03-21 19:23:42 +00:00
|
|
|
}
|
|
|
|
}
|
2020-02-18 07:57:00 +00:00
|
|
|
}
|
2019-03-21 19:23:42 +00:00
|
|
|
</style>
|