dayjs
dayjs copied to clipboard
immutable require clone API?
我认为 immutable 不需要 clone。 各位有告知一下 clone 的使用场景吗?
All public APIs are all immutable.
Still, if you want to get a copy of current Dayjs instance, use clone.
@iamkun Since immutable, why do you need to obtain a copy? There is no need for two identical objects.
For user from Moment, If they want to replace the package with Dayjs without modifying existing code, they might need this.
Cause there are quite a lot of clone used in a moment code.
@iamkun 出于兼容 moment 考虑可以理解。 如果不考虑兼容,我觉得可以私有 clone,没必要暴露出来给用户。