an annual calendar somewhere?
zryip theSlug
zryip.theslug at gmail.com
Sat Feb 27 14:21:06 EST 2010
2010/2/27 Andre.Bisseret <Andre.Bisseret at inria.fr>:
> Bonjour Zryip,
>
> Starting from your very nice script, I am modifying it so that I obtain one
> month per line.
> I managed to get the days of weeks repeated five times separated by tab in
> the first line of the field (with tab stops in it)
> I suppressed carriage returns and I added "tab" between weeks.
> Not too difficult up to now :-)
> Not completed yet (currently I am getting one month nearly as I expected.
>
> While doing trials, I just noticed that, when pFirstDayWeek is "Monday", if
> the first day of a month is actually "sunday" then there is a flaw: the "1"
> is set up under "monday" instead of "sunday" while "2" is at its right place
> (second line).
>
> I got that for example when trying "1/0810" (August 2010)
>
> This does not happen with pFirstDayWeek = "Sunday" (I tried for months
> beginning a saturday).
>
> I must confess that I did not study your script deeply
> (I just made few local modifications to quicky obtain a month with an
> aligned format instead of a table.
>
> So you likely will see faster than me how to fix that issue ;-))
Bonjour André!
Thanks for your feedback ;)
To fix this bug, replace the pad part by this new portion:
-- Pad beginning with empty days:
put createDate(tYear,tMonthNumber,1) into tStartDay
convert tStartDay to dateitems
get last item of tStartDay
if (pFirstDayWeek is "Monday") then
if (it = 1) then
put 6 into tPad -- fix the case that the day is Sunday (value
1) - 2 = - 1
else
put (it - 2) into tPad
end if
else
put (it - 1) into tPad
end if
repeat for tPad
put " " after tCal
end repeat
>
> Anyway, thanks a lot for your improvement of the Richard'script; I
> particularly appreciate the possibililty to choose between Sunday and Monday
> as the first day of week. Thanks to your script I am sure I will get the
> format I am expecting.
>
You're welcome 8-)
Now a little trick with my code. It could give you free times if you
have missed it ;)
How to create an easy loop to add months:
put createDate(2010,1,1) into tStartDate -- Create the January, 1 2010
in your local language system
repeat with tMonthNumber = 0 to 11 -- Create months for January (1) to
December (12)
put cal(addToDate(tStartDate,0,tMonthNumber,0),"Monday") & cr
after fld "MyField"
end repeat
Regards,
--
-Zryip TheSlug- wish you the best! 8)
http://www.aslugontheroad.co.cc
More information about the use-livecode
mailing list