I have an XLSForm which I use to collect survey data. I have date, so when the user select the date, the year is autoclaved and displayed as "18, 0r 19" meaning 2018 or 2019 depending on the date selected. the month is also auto generated from the selected date. I want to Auto generate week number from selected date in an xlsForm to be used in ODK? e.g. when I select 5th 1-7th October, 2018. I want to automatically see this: Year is 18, Month is Oct, Week is Week1 of Oct.
Auto generate week number from selected date
110 views Asked by Eastern Nursemid At
1
There will be two possible calculations. Take a look at the calendar.
Do you consider the third day as first week or second week?
If you consider it belongs to the first week, this function will solve your problem:
But if you consider it belongs to the second week, then the following function will solve your problem:
Both functions receive a date string and a date format. Both functions also need moment js library.
Here you have some results: