whoops
On Sun, Apr 28, 2019 at 5:17 PM Chris Cunningham cunningham.cb@gmail.com wrote:
Hi Chris,
I though of that. The number of methods that derive off of dayOfWeek is significant in Week; I'm not sure where outside of Week it is used as well.
Methods to change Week class #indexOfDay: #nameOfDay: #starting:duration: Week instance
#index
Maybe it is desirable to make a nearly complete overhaul, but I instead opted for minimum viable change.
That said, the only class that uses alternate Week starting days in MonthMorph, which does seem to work as-is (but CalendarMorph doesn't pay any attention to alternate months).
There is a bug in MonthMorph - if you try to bring up the menu on the title of the morph, it errors out (related to Week startDays - it thinks this should be a boolean even thought it sets it as a symbol elsewhere). More to fix, guess.
WeekMorph seems to only accept Sunday and Monday starts (which is a basis for MonthMorph, which also only support Sunday/Monday starts).
That is mostly it for classes in the base image.
It would be nice to support correct weeks (which y'all seem to be in agreement with). The best map of where different weeks start I found was at: http://chartsbin.com/view/41671 . (Although there are several comments, here and elsewhere, that the actual countries listed are wrong - and several countries they have not data for.)
I could have sworn that there was at least one country that also started their week on Friday, but I can't find any evidence of that online. Maybe I'll be able to track down the person that told me that - but I likely just heard him wrong.
Thanks, cbc
On Sun, Apr 28, 2019 at 4:02 PM Chris Muller asqueaker@gmail.com wrote:
What about keeping the existing selector #dayOfWeek, and making it respect Week>>startDay?
On Sun, Apr 28, 2019 at 8:35 AM David T. Lewis lewis@mail.msen.com wrote:
The addition of #dayOfLocalWeek is a good addition. But I want ask about the selector name and category. This isn't a criticism, more of a question because I do not understand how is it used in practice.
We have #toggleStartMonday that changes start day to either #Monday or #Sunday. This is an original brp method, but I don't know the reason for it. And #dayOfWeek is listed in the 'ansi-protocol'. Is the start day of week actually specified in the ANSI standard?
While I cannot think of any better selector name, I tend to think of "local" as refering to local time offset from UTC, so dayOfLocalWeek seems misleading in that sense. To me it seems more like dayOfLocalWeek is a dayOfWeek that is corrected for the toggled startDay. So maybe a name like correctedDayOfWeek or dayOfWeekCorrected might work? But these do not seem satisfactory either, because they do not suggest what is being corrected.
Suggestions welcome, and if nobody can think of a better idea then I am +1 for moving this to trunk as it is.
Dave
On Mon, Apr 22, 2019 at 04:00:19PM +0000, commits@source.squeak.org
wrote:
Chris Cunningham uploaded a new version of Chronology-Core to project
The Inbox:
http://source.squeak.org/inbox/Chronology-Core-cbc.41.mcz
==================== Summary ====================
Name: Chronology-Core-cbc.41 Author: cbc Time: 22 April 2019, 8:58:13.835953 am UUID: 3d8013b6-d58f-004e-8e6b-5a59ed5841e7 Ancestors: Chronology-Core-dtl.40
We have the ability to change the starting day of the week
(Week>>startDay:).
This change adds #dayOfLocalWeek to DateAndTime and Timespan to
return the indexed day of the week based on the altered starting day.
Original #dayOfWeek is left as-is along with all other working code.
=============== Diff against Chronology-Core-dtl.40 ===============
Item was added:
- ----- Method: DateAndTime>>dayOfLocalWeek (in category 'ansi
protocol') -----
- dayOfLocalWeek
"Sunday=1, ... , Saturday=7"
^ (self julianDayNumber + 2 - Week weekdayStartIndex rem: 7) + 1
- !
Item was added:
- ----- Method: Timespan>>dayOfLocalWeek (in category 'ansi
protocol') -----
- dayOfLocalWeek
"Answer the day of the week represented by the receiver."
^ start dayOfLocalWeek!
Item was added:
- ----- Method: Week class>>weekdayStartIndex (in category 'squeak
protocol') -----
- weekdayStartIndex
^self indexOfDay: self startDay!