Open fredt34 opened 11 months ago
Apologies for the late reply.
Based on the error dayjs(timetsamp).from is not a function
, I suspect the issue may be related to dayjs
not having yet used the relativeTime
plugin (which is needed for the relative time aspect).
I've also since updated the README to fix the custom locale instructions.
For me, the following prints out 4 роки тому
.
<script>
import "dayjs/locale/uk";
// Apply the locale globally
dayjs.locale("uk");
import Time, { dayjs } from "svelte-time";
</script>
<Time relative timestamp={dayjs("2020-01-01")} />
I installed Svelte with bun, it uses recent versions:
It runs in a lxd container.
I created this test pages +page.svelte to test various cases:
Last lines triggers a console error:
TypeError: __vite_ssr_import_1__.dayjs(timestamp).from is not a function. (In '__vite_ssr_import_1__.dayjs(timestamp).from()', '__vite_ssr_import_1__.dayjs(timestamp).from' is undefined)
I'm quite starting tinkering with svelte and javascript, so I might have missed something obvious (or my config is too exotic ?) All my other tests about Svelte / Kit are ok.
Plus, I'm a bit surprised that not every date applies the locale defined? Is a format really mandatory?