Closed GoogleCodeExporter closed 8 years ago
i did it like this (hardcoded way) since i didn't find any option for this:
line 779 - 786
function dateFirstDayOfWeek(date) {
var midnightCurrentDate = new Date(date.getFullYear(), date.getMonth(),
date.getDate());
var currentDayOfWeek = midnightCurrentDate.getDay();
var millisToSubtract = currentDayOfWeek * 86400000;
return new Date(midnightCurrentDate.getTime() - millisToSubtract + 86400000);
}
so basically i just add 86400000 ( = 24 hours) to the date, and after that you
just
have to change the headers aswell,
var dayNames =
['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];
psst: this is all ofcourse done in jquery.weekcalendar.js file
might not be the best solution, but sure works for me :)
Original comment by ted.mellin
on 22 Jun 2009 at 8:32
I'll put this on the to-do list so that it comes as valid config.
Original comment by robmo...@gmail.com
on 23 Jun 2009 at 4:32
Hi robmonie,
this can easily be fixed by doing so:
add an option "firstDayOfWeek" to $.ui.weekCalendar.defaults, eg:
firstDayOfWeek : 1 // 0 = Sunday, 1 = Monday, 2 = Tuesday, ... , 6 = Saturday
Then adjust _dateFirstDayOfWeek and _dateLastDayOfWeek to include this offset:
var currentDayOfWeek = midnightCurrentDate.getDay() -
this.options.firstDayOfWeek; //
Bramus! fix for configurable first day of week
By this the dates will be shifted. The one thing left to change then is to
"rotate"
the labels (so that they move with the dates), by adding the code below to
_computeOptions:
// Bramus! fix for configurable first day of week: rotate day labels
if (options.firstDayOfWeek != 0)
{
rotate = function(a, p){ // rotate v1.0 - @see
http://snippets.dzone.com/posts/show/2202
for(var l = a.length, p = (Math.abs(p) >= l && (p %= l), p < 0 && (p += l),
p), i, x; p; p = (Math.ceil(l / p) - 1) * p - l + (l = p))
for(i = l; i > p; x = a[--i], a[i] = a[i - p], a[i - p] = x);
return a;
};
options.shortDays = rotate(options.shortDays, (-1) * options.firstDayOfWeek);
options.longDays = rotate(options.longDays, (-1) * options.firstDayOfWeek);
}
if this is confusing to you, feel free to mail me (or give me SVN access to
that I
can commit a patch ;))
Regards,
Bramus!
Original comment by b...@bram.us
on 24 Jun 2009 at 4:54
Thank you very much for this tips ! you saved me a lot of time.
Just a little bug since i put your patch when i create event,event block doesnt
fill
the whole column width.
Original comment by mustapha.fodil
on 29 Jul 2009 at 3:12
Original comment by robmo...@gmail.com
on 10 Aug 2009 at 8:47
Original comment by robmo...@gmail.com
on 10 Aug 2009 at 9:43
Original comment by robmo...@gmail.com
on 10 Aug 2009 at 10:01
Original issue reported on code.google.com by
gorazd.p...@gmail.com
on 21 Jun 2009 at 7:38