NSCalendar, why does setting the firstWeekday doesn't effect calculation outcome?

前端 未结 3 1771
不思量自难忘°
不思量自难忘° 2020-12-19 09:31

i need to calculate the weekday for a given date, however, depending on the calendar a week can star on Monday and somwhere on Sunday

so i wanted to set it, to start

3条回答
  •  半阙折子戏
    2020-12-19 09:58

    The behavior you see is correct. The weekday component is not affected by the firstWeekday property. If you have a date representing a sunday it will always be a sunday wether you start your week on that sunday or on monday. What this should affect is the week number in the week property of your date components.

提交回复
热议问题