I asked a native and I was told that it doesn't work as a sentence. If it was something like "I work eighteen weeks per year", then it would be correct.
It doesnt take "I work 18 weeks", though that is perfectly fine English. It is annoying when Duolingo doesn't recognize your native language.
Actually, it's an incomplete phrase which needs an object complement like "per year" or a preposition like "for" to turn it into an adjunct. Either "I work eighteen weeks per year" or "I work for eighteen weeks" would be grammatically correct (though only the latter is a translation of the given Polish sentence, of course).
I can assure you it is completely standard usage to leave out the "for", at least in the US, and it has the same grammatical status as "three years" in I've lived here three years", which is also completely standard. "Per year" is a modifier of the phrase "eighteen weeks" that can be omitted if it is understood. I often tell people I work 9 months (teaching) without confusion. I can see being fussy about the Polish, but Duolingo should assume people know something about their native language, even if common usage may not always be 100% grammatical in a technical sense.(One would not expect complaints about split infinitives, for example, since most people don't care in conversation.)
Well, I guess that if you assure us that it's standard in the US, then there's no much point arguing... added now.