Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

state can only be strings? #498

Open
mattfelten opened this issue Jan 24, 2020 · 2 comments
Open

state can only be strings? #498

mattfelten opened this issue Jan 24, 2020 · 2 comments

Comments

@mattfelten
Copy link
Contributor

```react|plain,light,span-3
state: {
	date: new Date(),
}
---
<div>{state.date}</div>

^^ shows up as "new Date()", like it's turned into a string instead of generating a date.

Saving new Date() to an external variable and passing that variable through to state turns the name of the variable to a string also.

Any ideas how to have an example using todays date in a real date format?

@Jordan-Morrison
Copy link

Have you tried using a query string at all?

state: {
	date: `${new Date()}`,
}

@mattfelten
Copy link
Contributor Author

I haven't. Does that work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants