You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created this test pages +page.svelte to test various cases:
Time is Ok
relative is Ok with standard language
Time displays the date correctly in another locale (case 3 - but only with a dayjs date), not with a regular date (case 4)
Last test to display a relative date in another locale triggers an Error 500
<script context="module">
import "dayjs/esm/locale/uk"
import dayjs from "dayjs/esm"
dayjs.locale("uk") // Ukrainian locale to be sure
</script>
<script>js
import Time from "svelte-time"
let djsDate = dayjs()
let djsDateFormatted = dayjs().format("DD MMMM YY")
</script>
ok <Time timestamp="2020-01-01" /><br />
ok <Time relative timestamp="2020-01-01" /><br />
ok <Time timestamp={dayjs("2020-01-01")} format="MMMM" /><br />
oko? <Time timestamp="2020-01-01" format="MMMM" /><br />
ko
<!-- <Time relative timestamp={dayjs("2020-01-01")} format="MMMM" /><br /> -->
<!-- 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) -->
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?
The text was updated successfully, but these errors were encountered:
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.
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?
The text was updated successfully, but these errors were encountered: