I want to have the option to change the first day of the week as displayed in the Month and Week views.
I could be entirely missing the setting somewhere. I'm running a fresh install on NextCloud 10.
This setting depends of your user's language and cannot be chosen manually currently.
Is a manual choice in the roadmap for the future? At least toggling between Sunday and Monday?
Kind of. There is the plan to add a dedicated region setting to the server.
That looks like it would probably solve the issue. In the region setting issue, you said
We already ditched the checkbox for 12/24 and start of week for good
That seems like there was a decision to remove the feature I'm requesting?
Yes, we had this feature in version 0.x before Nextcloud 9.
But there have been big changes for everything *DAV in Nextcloud 9, so we had to rewrite the calendar app.
Version 0.x is also no longer supported
Alright, that certainly sounds reasonable. I'll survive until the dedicated region option releases :)
the config is in js/public/app.js. search for baseConfig and change firstDay option to 1 if you want Monday, or I think 6 if you want Sunday. As of today, this is where you would find it: https://github.com/nextcloud/calendar/blob/master/js/app/directives/fullCalendarDirective.js#L91
@fengshaun
What's the correct syntax to modify the firstDay value in js/public/app.js?
I tried it with 'firstDay: '1', ` , but this doesn't work? (I'm not experienced with JS...)
I haven't taken a look, but did you try firstDay: 0? If Sunday is day 6 then Monday is likely day 0.
@matt407 You have to use firstDay: 1, not firstDay: '1'
@Raindeer44 and @georgehrke
Thank you for your reply.
I tried it, but it doesn't influence something? Sunday is still the first day.
var baseConfig = {
dayNames: dayNames,
dayNamesShort: dayNamesShort,
defaultView: attrs.initialView,
editable: !isPublic,
firstDay: 1,
forceEventDuration: true,
header: false,
height: windowElement.height() - headerSize,
locale: moment.locale(),
monthNames: monthNames,
monthNamesShort: monthNamesShort,
nowIndicator: true,
weekNumbers: attrs.weeknumbers === 'yes',
weekNumbersWithinDays: true,
selectable: !isPublic
};
@fengshaun's comment is a little outdated. You will have to find that piece of code in the app.min.js and edit it there.
@georgehrke
Okay, I had a look to the app.min.js file - the baseConfig section cannot be found there?
I found the var only there:
firstDay:+l.firstDayOfWeek()
firstDay:F,
Many thanks in advance.
Found what seems to be a better solution. Find the line containing moment.locale in nextcloud/core/js/js.js, and change it to whatever you like. I replaced it with this according to my own taste (I only copied en_gb from moment's locales and changed the date format to ISO):
1237 moment.locale("en", {
1238 months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
1239 monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
1240 weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
1241 weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
1242 weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
1243 longDateFormat : {
1244 LT : 'HH:mm',
1245 LTS : 'HH:mm:ss',
1246 L : 'YYYY-MM-DD',
1247 LL : 'MMMM D YYYY',
1248 LLL : 'MMMM D YYYY HH:mm',
1249 LLLL : 'dddd, MMMM D YYYY HH:mm'
1250 },
1251 calendar : {
1252 sameDay : '[Today at] LT',
1253 nextDay : '[Tomorrow at] LT',
1254 nextWeek : 'dddd [at] LT',
1255 lastDay : '[Yesterday at] LT',
1256 lastWeek : '[Last] dddd [at] LT',
1257 sameElse : 'L'
1258 },
1259 relativeTime : {
1260 future : 'in %s',
1261 past : '%s ago',
1262 s : 'a few seconds',
1263 m : 'a minute',
1264 mm : '%d minutes',
1265 h : 'an hour',
1266 hh : '%d hours',
1267 d : 'a day',
1268 dd : '%d days',
1269 M : 'a month',
1270 MM : '%d months',
1271 y : 'a year',
1272 yy : '%d years'
1273 },
1274 ordinalParse: /\d{1,2}(st|nd|rd|th)/,
1275 ordinal : function (number) {
1276 var b = number % 10,
1277 output = (~~(number % 100 / 10) === 1) ? 'th' :
1278 (b === 1) ? 'st' :
1279 (b === 2) ? 'nd' :
1280 (b === 3) ? 'rd' : 'th';
1281 return number + output;
1282 },
1283 week : {
1284 dow : 1, // Monday is the first day of the week.
1285 doy : 4 // The week that contains Jan 4th is the first week of the year.
1286 }
1287 });
You can find such locale definitions in nextcloud/core/vendor/moment/min/moment-with-locales.js.
As for monday being the first day, I modified nextcloud/app/calendar/js/public/app.js and changed every occurrence of firstDay to be 1 (monday) everywhere. Then rename app.js to app.min.js because the latter is what gets included.
For 24h time format, change the line containing timeFormat: in app.min.js or app.js to 'H:mm' and you'll get proper time format. I haven't yet figured out how to change the left column time format.
The problem with all of this is that you'll be wasting a lot of time trying to figure out where everything is again with every update. I don't plan on upgrading nextcloud anytime soon since I don't have the time to fiddle with this anymore, so be warned.
There is a simpler solution to this issue (for individual users). The default calendar layout is linked to the language that the user has defined as default. A user can change their language in their settings (personal), in the language section. By changing from "English (US)" to "English (British English)", you will have the weeks starting on Mondays.
If you want to change the default settings for all users, you might want to change the default language in NextCloud core (config/config.php) to "en-GB" (I haven't tried, but assume it should do the trick).
It becomes problematic when someone wants to mix formats. I like my dates in ISO, and time in 24hr format, and my weeks starting on monday. I can't think of any national locale that does that.
Please, please, please, let each person choose whatever it needs... there is no consensus even in the same locale.
Thanks a lot... :)
Most helpful comment
It becomes problematic when someone wants to mix formats. I like my dates in ISO, and time in 24hr format, and my weeks starting on monday. I can't think of any national locale that does that.