Element: [Bug Report] datepicker week type doesn't consider firstWeekOfDay

Created on 29 Aug 2017  ·  7Comments  ·  Source: ElemeFE/element

Element UI version

1.4.3

OS/Browsers version

Ubuntu 16.04 / Chrome Latest

Vue version

2.4.2

Reproduction Link

https://jsfiddle.net/pj71jkyw/517/

Steps to reproduce

1.Click on the date picker.
2.Pick any week

What is Expected?

It should take Sunday as the first day since it has prop firstDayOfWeek=7

What is actually happening?

By default it takes monday for any value of firstDayOfWeek

date-picker stale bug

Most helpful comment

@Leopoldthecoder I am experiencing the issue as well, your given JSFiddle actually demonstrates the issue. If the firstDayOfWeek parameter is set to 7 it should be selecting the date of Sunday instead of Monday. The issue seems to be caused by this line:

https://github.com/ElemeFE/element/blob/762f337b2c8eac32eb1cc85c4af1e7718973cdeb/packages/date-picker/src/basic/date-table.vue#L364-L366

Where it is automatically selecting the cell at index 1. Shouldn't this change depending on what the firstDayOfWeek parameter is? A better option might actually be to select the first cell (index 0) no matter what so that when you do set the firstDayOfWeek so you know it will be returning that day. Currently in your example when you have the first day of the week set to Wednesday, it is returning the date for Thursday. I believe what @AshwinTayson is wanting is for it to return the day of the week she passes in.

All 7 comments

firstDayOfWeek should be nested in picker-options: https://jsfiddle.net/pj71jkyw/520/

It doesn't select sunday or any other other day even after the the change. It is monday by default.

@Leopoldthecoder I am experiencing the issue as well, your given JSFiddle actually demonstrates the issue. If the firstDayOfWeek parameter is set to 7 it should be selecting the date of Sunday instead of Monday. The issue seems to be caused by this line:

https://github.com/ElemeFE/element/blob/762f337b2c8eac32eb1cc85c4af1e7718973cdeb/packages/date-picker/src/basic/date-table.vue#L364-L366

Where it is automatically selecting the cell at index 1. Shouldn't this change depending on what the firstDayOfWeek parameter is? A better option might actually be to select the first cell (index 0) no matter what so that when you do set the firstDayOfWeek so you know it will be returning that day. Currently in your example when you have the first day of the week set to Wednesday, it is returning the date for Thursday. I believe what @AshwinTayson is wanting is for it to return the day of the week she passes in.

Yes, this is a bug. Will take a look later.

So that's the reason why it always chooses the day after the firstDayOfWeek here?
https://jsfiddle.net/simshaun/mmx38qxw/1927/

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Hi all, this issue actually still not fixed. I raise a new issue with repro link.

15683

Was this page helpful?
0 / 5 - 0 ratings

Related issues

no5no6 picture no5no6  ·  3Comments

Zhao-github picture Zhao-github  ·  3Comments

chao-hua picture chao-hua  ·  3Comments

EdenSpark picture EdenSpark  ·  3Comments

yuchonghua picture yuchonghua  ·  3Comments