weekNumber - Calendar

Hello,

How do I capture the WeekNumber in the calendar in JavaScript (see yellow highlight)? I would like to get the value and display it on a text field.

WeekNumber

Thanks,

Alberto

Hello @adasilva,

You can use Moment.js library to get the week number of the selected date.

fd.rendered(function() {

    $.getScript('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment-with-locales.min.js')
    .then(function() {

        fd.field('Date').$on('change', function(value) {
        fd.field('WeekNumber').value = moment(value).week();
        });
    })
}); 

You can find more information and code samples in our documentation here.