primevue-mirror/apps/showcase/doc/datepicker/FormatDoc.vue

74 lines
2.1 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Default date format is <i>mm/dd/yy</i> which can be customized using the <i>dateFormat</i> property. Following options can be a part of the format.</p>
2024-05-20 12:14:38 +00:00
<ul class="mb-6 leading-loose">
2023-02-28 08:29:30 +00:00
<li><i>d</i> - day of month (no leading zero)</li>
<li><i>dd</i> - day of month (two digit)</li>
<li><i>o</i> - day of the year (no leading zeros)</li>
<li><i>oo</i> - day of the year (three digit)</li>
<li><i>D</i> - day name short</li>
<li><i>DD</i> - day name long</li>
<li><i>m</i> - month of year (no leading zero)</li>
<li><i>mm</i> - month of year (two digit)</li>
<li><i>M</i> - month name short</li>
<li><i>MM</i> - month name long</li>
<li><i>y</i> - year (two digit)</li>
<li><i>yy</i> - year (four digit)</li>
<li><i>@</i> - Unix timestamp (ms since 01/01/1970)</li>
<li><i>!</i> - Windows ticks (100ns since 01/01/0001)</li>
<li><i>'...'</i> - literal text</li>
<li><i>''</i> - single quote</li>
<li><i>anything else</i> - literal text</li>
</ul>
</DocSectionText>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
2024-04-18 14:22:30 +00:00
<DatePicker v-model="date" dateFormat="dd/mm/yy" />
2023-02-28 08:29:30 +00:00
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
date: null,
code: {
2023-09-22 12:54:14 +00:00
basic: `
2024-04-18 14:22:30 +00:00
<DatePicker v-model="date" dateFormat="dd/mm/yy" />
2023-10-15 09:38:39 +00:00
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
2024-04-18 14:22:30 +00:00
<DatePicker v-model="date" dateFormat="dd/mm/yy" />
2023-02-28 08:29:30 +00:00
</div>
</template>
<script>
export default {
data() {
return {
date: null
};
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center">
2024-04-18 14:22:30 +00:00
<DatePicker v-model="date" dateFormat="dd/mm/yy" />
2023-02-28 08:29:30 +00:00
</div>
</template>
<script setup>
import { ref } from "vue";
const date = ref();
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>