-
-
Notifications
You must be signed in to change notification settings - Fork 999
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(module:datepicker): weekday header fix #1054
fix(module:datepicker): weekday header fix #1054
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1054 +/- ##
=========================================
- Coverage 6.61% 6.61% -0.01%
=========================================
Files 436 436
Lines 24137 24142 +5
=========================================
Hits 1596 1596
- Misses 22541 22546 +5
Continue to review full report at Codecov.
|
Thank you, but I think it adds complexity. Can we try the implementation of the react version? |
@ElderJames so what are we going to do with this PR? Am I dropping all that was done here and only address the issue fix? |
The work is great, and can we bring the locale changes to an other PR and only fix #1045 here? |
@ElderJames Whenever you're ready 馃槃 |
* fix(module:datepicker): weekday header fix * fix(module:rangepicker): reverse to only fix #1045
* fix(module:datepicker): weekday header fix * fix(module:rangepicker): reverse to only fix #1045
馃 This is a ...
馃敆 Related issue link
Fixes #1045
馃挕 Background and solution
The issue itself was simple to fix. Had to just transfer code from
DatePickerDatePanlel
toDatePickerDateTimePanel
, because there was an old evaluation of starting date.But I dig a bit deeper and I found a possible problem, that I decided I will try to fix.
I am referring to
DatePickerLocale.cs
. There is a field thereShortWeekDays
that is an array of shorthand weekday names. This is exposed and can be set by a consumer. The problem is when a consumer decides to put the order of the weekdays starting from a different index than Sunday. Which is not unexpected - for me, a more natural order is{ "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su" }
. In such case the order will be screwed up andFirstDayOfWeek
will have to point to 'Sunday" for this to actually start showing from 'Monday". So I added a new propertyMondayIndex
. It will store index inShortWeekDays
that will be Monday. So in the example I gave it should beMondayIndex = 0
.I also added a new method in
DatePickerLocale.cs
so properly ordered array can be fetched (ShortWeekDaysSorted
).Another method I added is
SetShortWeekDays(string[] shortWeekDays, int mondayIndex)
that will set the properties. To be honest, I would prefer to completely get rid of propertiesMondayIndex
andShorWeekDays
(in favour of private fields) and rely completely onSetShortWeekDays
, but I can see it is needed because of json deserialization.What do you think? If this is ok, I will also try to make changes to locale json files to include the
mondayIndex
(as I did for 3 languages).馃摑 Changelog
MondayIndex
property onDatePickerLocale.cs
class that stores Monday index inShortWeekDays
.鈽戯笍 Self Check before Merge