Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datepicker footer امروز weekday ob1 #10

Closed
ehsanamini opened this issue May 21, 2016 · 2 comments
Closed

datepicker footer امروز weekday ob1 #10

ehsanamini opened this issue May 21, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@ehsanamini
Copy link

ehsanamini commented May 21, 2016

weekday of today in the footer is off by 1 day

I fixed it by changing line 331 from:

todayDateTimeString = 'امروز، ' + getPersianWeekDay(persianTodayDateTemp[2]) + ' ' + toPersianNumber(currentDayNumber) + ' ' + getPersianMonth(currentMonthNumber) + ' ' + toPersianNumber(currentYearNumber),

to

todayDateTimeString = 'امروز، ' + getPersianWeekDay((persianTodayDateTemp[2]+6)%7) + ' ' + toPersianNumber(currentDayNumber) + ' ' + getPersianMonth(currentMonthNumber) + ' ' + toPersianNumber(currentYearNumber),

(persianTodayDateTemp[2]+6)%7 was chosen rather than simply (persianTodayDateTemp[2]-1) to avoid getting a possibly negative function argument on Sunday.

It seems to work for today, haven't yet tested it for other days though.
Alternatively, relying on the JS native i18n API, replacing the entire RHS with 'امروز، ' + (new Date).toLocaleDateString("fa-IR", {weekday: "long", year: "numeric", month: "long", day: "numeric"}).slice(0, -5), will also do the trick and be less of a hack.

@Mds92 Mds92 added the bug label May 21, 2016
@Mds92 Mds92 self-assigned this May 21, 2016
@Mds92
Copy link
Owner

Mds92 commented May 21, 2016

Thanks for your report and sample code.
I'll fix it in next version, as soon as possible

@Mds92 Mds92 added this to the Fix some bugs milestone May 21, 2016
@Mds92
Copy link
Owner

Mds92 commented May 21, 2016

Get the new version

@Mds92 Mds92 closed this as completed May 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants