Baremetrics / calendar

Date range picker for Baremetrics
MIT License
679 stars 78 forks source link

Should not call new Date #28

Closed SleeplessByte closed 8 years ago

SleeplessByte commented 8 years ago

The whole point of moment is that it normalizes new Date() calls. Instead replace the calls with moment(). All operations should be moment operations.

For example new Date('January 1, 1900') becomes moment( [1900, 1, 1] ) or moment( '1900-01-01', 'YYYY-MM-DD');

kalepail commented 8 years ago

Mm unfortunately this would place limitations on the date formats you could use when instantiating the calendar or entering dates but I could and will do better on not using new Date when I don't need to.

kalepail commented 8 years ago

https://github.com/Baremetrics/calendar/commit/ef9bd8cedca66ffb268f6776a2820d46995ba03a

kalepail commented 8 years ago

On second thought I think I'd like to limit the date input to that format for consistency's sake. https://github.com/Baremetrics/calendar/commit/22e0256e0b76d6f49085eb59ee1b20474ef29e55

SleeplessByte commented 8 years ago

You should probably limit to a format, not necc. that format, with regards to #26 #2

kalepail commented 8 years ago

Opening this back up.. I didn't like my implementation. It works for me as is but if someone wants to knock it out that's fine by me.

SleeplessByte commented 8 years ago

I'll look into it :)

On Fri, 4 Sep 2015 13:45 Tyler van der Hoeven notifications@github.com wrote:

Opening this back up.. I didn't like my implementation. It works for me as is but if someone wants to knock it out that's fine by me.

— Reply to this email directly or view it on GitHub https://github.com/Baremetrics/calendar/issues/28#issuecomment-137803067 .