Ability to enable the week column in the Calendar and DatePicker widgets. Also there will be ability to calculate the week number differently if needed (for example to display a fiscal year).
@yordanov: design welcome :)
cc @ggkrustev
I would suggest to implement the week number with a separate template, just like the month.content and month.empty. This will give the users the ability to modify the content or even to perform custom calculations there if needed.
We could go for a month.weekNumber option, which will accept a Kendo Template. The passed data will include 2 params:
function weekNumberCallback() {
// data.weekNumber - calculated week number
// data.currentDate - current date used for the week number calc
}
The new configuration option should be proxied to the DatePicker/DateTimePicker configuration.
Need also to add option for localization of the week number header, e.g. 'Wk'.
Thank you for the suggestions! I made some progress with the implementation of the feature, but I would like to discuss an idea:
Hi @boyandim,
Although, I am really keen to use just the month.weekNumber option to enable/disable the week number column, I think that we will need both:
showWeekNumber on root level to enable/disable the week columnmonth.weekNumber template option to control week number renderingHere are my arguments in defence to the suggested configuration:
weekNumber most probably will _not be enabled_ by default or I am mistaken? If this is true, we will need to provide an easy way to enable weekNumber without the need to specify templatemonth.weeNumber template to 'false' (verbose)With the above configuration, we will be able to provide a default weekNumber template and enable/disable it on the fly.
I would be happy to hear the @tsvetomir opinion? Should we enable weekNumber by default or not? I am willing to enable it, but I am not sure how this will affect all users. The calendar is in use for the last 5 years without major changes, such rendering change is not little.
Definitely an opt-in feature. We don't want to surprise anyone with a layout change.
Thank you for your valuable feedback. I agree that it is better to have an option for disabling/enabling the week column. Therefore currently there is such option, but it is defined on month level (not at root level). I will modify it to make it a global option for the calendar.
Since this feature is already implemented I am looping @inikolova into this discussion. Could you please check the referenced issue in kendo repo for styling suggestions provided by Vassil?
Looking at the weekInYear method, it should be well explained in our documentation how we calculate the week number.
Some article like this would be helpful.
https://msdn.microsoft.com/en-us/library/system.globalization.calendarweekrule(v=vs.110).aspx
The help must also contain an example on how they can achieve something with custom function if they want, something like this:
https://blogs.msdn.microsoft.com/shawnste/2006/01/24/iso-8601-week-of-year-format-in-microsoft-net/
Indeed, as the weekInYear method will be released under kendo.date namespace, we will need to document it. Thanks for the hint.
@boyandim could you document the method in the kendo.date page? Pointing out what is the supported params and the possible return will be just fine.
Also I do believe that @boyandim will add a specific demo for the 'week number' feature and will update the current templates demo showing a custom usage. I believe this will be enough for now.
As far as I see, the material theme does not have styling for the week column:

Most helpful comment
Definitely an opt-in feature. We don't want to surprise anyone with a layout change.