Closed DeTeam closed 11 years ago
what's wrong with .addDays(-1)
and .addDays(+1)
?
Does it mute prev. date?(:
On Monday, March 4, 2013, Daniel A. White wrote:
what's wrong with .addDays(-1) and .addDays(+1)?
— Reply to this email directly or view it on GitHubhttps://github.com/arshaw/xdate/issues/20#issuecomment-14384536 .
Best Timur DeTeam Amirov Moscow, Russia
@DeTeam what do you mean by "mute"?
"Mutable state" like that It modify existing date object or create new one? Those methods I proposed wouldn't touch existing date and create new one
On Monday, March 4, 2013, Daniel A. White wrote:
@DeTeam https://github.com/DeTeam what do you mean by "mute"?
— Reply to this email directly or view it on GitHubhttps://github.com/arshaw/xdate/issues/20#issuecomment-14384748 .
Best Timur DeTeam Amirov Moscow, Russia
it mutates the internal state.
You can easily then just .clone().addDays(-1)
and .clone().addDays(+1)
Ok, it'd just be semantically handy to have shortcuts for that :)
On Monday, March 4, 2013, Daniel A. White wrote:
it mutates the internal state.
You can easily then just .clone().addDays(-1) and .clone().addDays(+1)
— Reply to this email directly or view it on GitHubhttps://github.com/arshaw/xdate/issues/20#issuecomment-14387298 .
Best Timur DeTeam Amirov Moscow, Russia
you could extend XDate...
XDate.prototype.tomorrow = function() {
return this.clone().addDays(1);
};
It may be handy to have those two methods for XDate object.
xdate.tomorrow() xdate.yesterday()
That'd just move the date (not time) to the next or prev. date. What do you think?