andrewplummer / Sugar

A Javascript library for working with native objects.
https://sugarjs.com/
MIT License
4.53k stars 306 forks source link

Sugar.Date().valueOf() returns a date object rather than a number #608

Open alFReD-NSH opened 7 years ago

alFReD-NSH commented 7 years ago

Currently require('sugar').Date().valueOf() returns an object rather a number like javascript new Date().valueOf() or even require('sugar').Date.create().valueOf().

This breaks where you can do stuff like date1 < date2 with javascript dates but not with sugar dates.

alFReD-NSH commented 7 years ago

Though one could easily work around it, by just using sugar methods or converting to Javascript dates.

alFReD-NSH commented 7 years ago

Another thing I realised, toJSON is also broken.