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
However, since value is a Date when used in the iframe, but is a number when used in a new tab (by clicking on the open Canvas in new tab button), it always initializes to the current date.
When deserializing, the value is a string instead of a number, and so will be the string representation of the timestamp. The Date object then tries to parse this string as a date string, fails, and falls back to today's date.
FYI, we’ve released addon-controls in Storybook 6.0. Controls are portable, auto-generated knobs that are intended to replace addon-knobs, which are slated for deprecation.
Describe the bug
https://github.com/storybookjs/storybook/blob/next/addons/knobs/src/converters.ts#L18 has this deserialization code:
However, since
value
is aDate
when used in the iframe, but is anumber
when used in a new tab (by clicking on theopen Canvas in new tab
button), it always initializes to the current date.https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date
When deserializing, the value is a
string
instead of a number, and so will be the string representation of the timestamp. The Date object then tries to parse this string as a date string, fails, and falls back to today's date.fix is straightforward:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Code snippets
If applicable, add code samples to help explain your problem.
System
Please paste the results of
npx sb@next info
here.Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: