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

Date.fromTime 1422777600000 returns {} in elm-repl #441

Closed
berndca opened this Issue Nov 20, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@berndca

berndca commented Nov 20, 2015

I expected

Date.fromTime 1422777600000

to return

// new Date(1422777600000.0)
Sun Feb 01 2015 00:00:00 GMT-0800 (PST)

However I got {} : Date.Date

I'm using elm-repl 0.16. Am I missing something?
Thanks, Bernd

@rgrempel

This comment has been minimized.

Show comment
Hide comment
@rgrempel

rgrempel Nov 20, 2015

Contributor

I think the issue you are seeing is that toString doesn't produce what you might expect from a Date.

For instance, here's an elm-repl session:

> import Date
> date = Date.fromTime 1422777600000
{} : Date.Date
> toString date
"{}" : String
> Date.year date
2015 : Int
> Date.month date
Feb : Date.Month
> Date.day date
1 : Int

So, you can see that elm-repl really has created a date, and you really can use it in functions. However, toString just doesn't produce what you might expect.

Contributor

rgrempel commented Nov 20, 2015

I think the issue you are seeing is that toString doesn't produce what you might expect from a Date.

For instance, here's an elm-repl session:

> import Date
> date = Date.fromTime 1422777600000
{} : Date.Date
> toString date
"{}" : String
> Date.year date
2015 : Int
> Date.month date
Feb : Date.Month
> Date.day date
1 : Int

So, you can see that elm-repl really has created a date, and you really can use it in functions. However, toString just doesn't produce what you might expect.

@berndca

This comment has been minimized.

Show comment
Hide comment
@berndca

berndca Nov 20, 2015

Thanks for the clarification! I guess the toString issue might be related to the fact that a native function call is used. Are there any plans to adjust the output of toString or perhaps to at least output a message indicating the limitation?

Thanks, Bernd

berndca commented Nov 20, 2015

Thanks for the clarification! I guess the toString issue might be related to the fact that a native function call is used. Are there any plans to adjust the output of toString or perhaps to at least output a message indicating the limitation?

Thanks, Bernd

rgrempel added a commit to rgrempel/core that referenced this issue Nov 21, 2015

@rgrempel

This comment has been minimized.

Show comment
Hide comment
@rgrempel

rgrempel Nov 21, 2015

Contributor

I've submitted a PR -- see #442

Contributor

rgrempel commented Nov 21, 2015

I've submitted a PR -- see #442

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
@jvoigtlaender

jvoigtlaender Jan 19, 2016

Contributor

Since there is a pull request addressing this issue, I am closing the issue itself.

Contributor

jvoigtlaender commented Jan 19, 2016

Since there is a pull request addressing this issue, I am closing the issue itself.

rgrempel added a commit to rgrempel/core that referenced this issue Jun 24, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment