ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #01764
Re: [Merge] lp:~pkunal-parmar/ubuntu-calendar-app/WeekNumber into lp:ubuntu-calendar-app
@Nicholas: I have tested this branch and it is ok. When I put en_US locale weeks start on Sundays and end on Saturdays and Week numbers are right (w17 starts Sun 19 Apr ends Sat 25 Apr - w18 starts Sun 26 Apr ends Sat 2 May). When I put it_IT locale weeks start on Mondays and end on Sundays (w17 starts Mon 20 Apr and ends Sun 26 Apr - w18 starts Mon 27 Apr and ends Sun 3 May).
I wanted to fix the test: TestDayView.test_default_view, but I haven't found yet how to get what is the first day of the week for each country.
This works:
locale = self.app.main_view.get_default_locale()
if locale == ('it_IT', 'UTF-8'):
week = int(now.strftime("%W"))+1
elif locale == ('en_US', 'UTF-8'):
week = int(now.strftime("%U"))+1
But I do not think it's the best way to do it as I will have to put all the countries in.
I am still tyring to find a way to get the first day of the week using something like calendar.firstweekday() but this gives me always 0 as first day of the week both in it_IT and en_US so it's the right to use.
Have you guys got an idea how to do this ?
Carla
--
https://code.launchpad.net/~pkunal-parmar/ubuntu-calendar-app/WeekNumber/+merge/255078
Your team Ubuntu Calendar Developers is subscribed to branch lp:ubuntu-calendar-app.
References