diff --git a/components/post-card.vue b/components/post-card.vue new file mode 100644 index 0000000..0246472 --- /dev/null +++ b/components/post-card.vue @@ -0,0 +1,26 @@ + + + \ No newline at end of file diff --git a/components/posts-article-list.vue b/components/posts-article-list.vue new file mode 100644 index 0000000..8a464e0 --- /dev/null +++ b/components/posts-article-list.vue @@ -0,0 +1,26 @@ + + + diff --git a/composables/formatDate.ts b/composables/formatDate.ts new file mode 100644 index 0000000..4e44e65 --- /dev/null +++ b/composables/formatDate.ts @@ -0,0 +1,11 @@ +import dayjs from 'dayjs' +import localizedFormat from 'dayjs/plugin/localizedFormat' +import 'dayjs/locale/th' +import 'dayjs/locale/en' + +dayjs.extend(localizedFormat) + +export const useFormatDate = (date: string) => { + const localizedDayjs = dayjs(date).locale('en') + return localizedDayjs.format('D MMMM YYYY - HH:mm') +} diff --git a/composables/relativeDate.ts b/composables/relativeDate.ts new file mode 100644 index 0000000..0bc52ac --- /dev/null +++ b/composables/relativeDate.ts @@ -0,0 +1,10 @@ +import dayjs from 'dayjs' +import relativeTime from 'dayjs/plugin/relativeTime' +import 'dayjs/locale/en' + +dayjs.extend(relativeTime) + +export const useRelativeDate = (date: string) => { + dayjs.locale('en') + return dayjs().to(dayjs(date)) +} \ No newline at end of file diff --git a/pages/posts/[...slug].vue b/pages/posts/[...slug].vue new file mode 100644 index 0000000..80ad994 --- /dev/null +++ b/pages/posts/[...slug].vue @@ -0,0 +1,58 @@ + + + \ No newline at end of file diff --git a/pages/posts/index.vue b/pages/posts/index.vue new file mode 100644 index 0000000..c3eabc8 --- /dev/null +++ b/pages/posts/index.vue @@ -0,0 +1,29 @@ + + + \ No newline at end of file