I have been looking for a Javascript algorithms that gives me the week number of a given Date object within a custom fiscal year. The fiscal year of my company starts on 1 September and ends on 31 August.
Say today happens to be September 1st and I pass in a newly instanced Date object to this function; I would expect it to return 1.
Hopefully someone will be able to help me with it.
Say you want the fiscal year for date X.
That should do it – maybe there’s a problem around new year, but easy enough to figure out I guess.
To get the week number within any year, there are plenty of solutions. Here’s just one of them: http://syn.ac/tech/19/get-the-weeknumber-with-javascript/