timrwood/moment — Issue #184: Handling of empty dates
Author: rquantz
Created: 2012-02-29 21:29:09+00:00
State: open

Thanks so much for this library, it really has been very helpful. That being said, it would be nice if various versions of creating empty dates could be handled similarly. Currently:

moment('');
>> Invalid Date

moment(null);
>> null

moment('', 'YYYY-MM-DD');
>> TypeError: i is null

moment('').format('YYYY-MM-DD');
>> "NaN-NaN-NaN"

This has produced problems for me in passing date values back and forth with the server, when the date field is nullable. Obviously it can be dealt with, but more consistency would be helpful. Or is this the intended functionality?

Thanks!