alibaba-aero / jalaliday

Persian (Jalali, Khorshidi) Plugin for Day.js
MIT License
131 stars 21 forks source link

Fix endOf, daysInMonth, subtract and calendar persistence issues #8

Closed mpourismaiel closed 5 years ago

mpourismaiel commented 5 years ago

UPDATE: Sorry my previous commit (removed by force push) didn't solve the problem. Also removed the PR note so this one is the new one.

Issues fixed

Tests

 PASS  test/plugin.test.js
 PASS  test/relaiable-calendar-change.test.js
-------------|----------|----------|----------|----------|-------------------|
File         |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-------------|----------|----------|----------|----------|-------------------|
All files    |    98.15 |       96 |    97.06 |    98.13 |                   |
 calendar.js |    95.35 |    84.62 |      100 |    95.35 |           123,132 |
 constant.js |       90 |      100 |        0 |       90 |                17 |
 index.js    |      100 |      100 |      100 |      100 |                   |
 plugin.js   |    99.39 |    98.99 |      100 |    99.38 |               155 |
-------------|----------|----------|----------|----------|-------------------|

image

mpourismaiel commented 5 years ago

@farnabaz Is there anything else wrong or problematic with the PR?

farnabaz commented 5 years ago

@mpourismaiel I add a test for subtract function

Also, I don't think this it is a good idea to manipulate $set function to handle subtract logic, there should be a simpler way to fix this issue

mpourismaiel commented 5 years ago

There is. We would need to change calendar module but that is out of the scope of my expertise. This is a dirty patch to fix the problem for now, a better fix would be to either make calendar module handle negative values.

farnabaz commented 5 years ago

Thanks 🍺