spencermountain / spacetime

A lightweight javascript timezone library
http://spacetime.how/
Other
3.97k stars 183 forks source link

toLocalDate() would be better named as toNativeDate() #288

Closed coatesap closed 3 years ago

coatesap commented 3 years ago

The method toLocalDate() is easy to misunderstand - it could mean something related to the user's local timezone. I've actually made this false assumption a couple of times when reviewing PRs in our own codebase.

It would be more intuitive if it was called toNativeDate(). Tellingly, this is how the comment in the types file already describes it:

/** @returns the native Date object at the same epoch */
toLocalDate(): Date

Can I suggest that we rename the method, but leave toLocalDate() as a deprecated alias?

jecraig commented 3 years ago

I can get behind this. I was never happy with the name but I couldn't think of a better one at the time.

coatesap commented 3 years ago

Thanks @jecraig - I'll close this now.