You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description of the Issue and Steps to Reproduce:
Currently adding or subtracting 'isoweek' from a moment returns the same moment:
> m = moment()
moment("2018-03-28T13:12:35.901")
> m.add(1, 'isoweek')
moment("2018-03-28T13:12:35.901")
It would be convenient if isoweek was aliased to week in this use case so that the following would be returned:
> m = moment()
moment("2018-03-28T13:12:35.901")
> m.add(1, 'isoweek')
moment("2018-04-04T13:12:35.901")
The reason behind the request is that frequently have to "chunk" time series data by a user provided period (such as a week). moment.js makes it very simple to find the start of a chunk by doing something like moment(timestamp).startOf(period). However, if the period is isoweek, I can not simply calculate the next chunk as usual via moment.add(1, period) since this will return the same timestamp and not a timestamp 1 week in the future.
Environment:
Node.JS 8.9.4 on Ubuntu 16.0.4
The text was updated successfully, but these errors were encountered:
I want to +1 this, but at the same time I'm really annoyed that moment chose to start weeks on a sunday by default and not simply use the iso default. That would make everyone's lives a lot easier:
Oops doesn't work as intended, moment doesn't know how to handle subtraction of an iso week 🤦♂️
ichernev
changed the title
Support add(n, 'isoweek') and subtract(n, 'isoweek')
[feature] Support add(n, 'isoweek') and subtract(n, 'isoweek')
Jun 27, 2018
Description of the Issue and Steps to Reproduce:
Currently adding or subtracting 'isoweek' from a moment returns the same moment:
It would be convenient if isoweek was aliased to week in this use case so that the following would be returned:
The reason behind the request is that frequently have to "chunk" time series data by a user provided period (such as a week). moment.js makes it very simple to find the start of a chunk by doing something like
moment(timestamp).startOf(period)
. However, if the period is isoweek, I can not simply calculate the next chunk as usual viamoment.add(1, period)
since this will return the same timestamp and not a timestamp 1 week in the future.Environment:
Node.JS 8.9.4 on Ubuntu 16.0.4
The text was updated successfully, but these errors were encountered: