we need old parser as new doesn't support weeks. Than we can map what we need using w - year of year and u - first day of the week:
spark.sql("set spark.sql.legacy.timeParserPolicy=LEGACY")
spark.sql("""
SELECT
extract(
month from to_date("2022-12-1", "y-w-u")
) as month_of_year
""")