I'm new to Svelte and I'm trying to import an object I have in a separate JS file into my App.svelte file to be used. When I try and import the data, I get the whole function instead of the return value when I try and console log it or it return object Object. For simplicity sake, I just made date.js file that returns the date and I've tried the 2 export method up top, neither have worked.
date.js
module.exports = getDate
function getDate(){
date = Date()
return date;
}
In the App.svelte file I have:
<script>
import { getDate } from './date.js'
let date = getDate()
</script>
I noticed that in my node/express app, the return type of getDate is an Object and in the Svelte app the return type is a Number and I'm not sure why this is. Also the date.js file is location in the src folder so that isn't an issue. Any help would be appreciated! Thanks