Known Exoplanets orbiting main sequence stars have year lengths varying from 4.31 hurs to about 1,000,000 years, so the longest known year is about 2,040,816,327 times as long as the shortest.
But the requirements for planetary habitabiity for carbon based and liquid water using life, and especially for oxygen breathing varieties of life are quite strict.
A fiction writer who wanted to be rather certain that their story was not proved to be impossible might restrict the orbits and stars of habitable planets so that the longest year would be only about ten times as long as the shortest year. If the writer is willing to take a greater risk of story elements being proved impossible, the longest year of an inhabited planet could be about one hundred times as long as the shortest. If the writer is willing to make more daring - and more likely to be proved wrong - assumptions about habitable planets, the longest possible year of a habitable planet might be about a thousand times as long as the shortest year.
And if a fiction writer takes the risk of using hypothetical exotic alien biochemistries in his story, the range of year lengths among habitable and inhabited worlds might be much greater. And yet it would probably still be a very small range compared to the range of possible exoplanet year lengths.
Part One of Seven: Which specral types of stars can have habitable planets?
Here is a link to a question:
The answer by user177107 has a table of main-seuence stars of different masses and spectral types. It lists for each star the distance at which a planet would receive exactly as much radiation from the star as Earth gets from the Sun, and the length of that planet's orbital period or year.
for example, the distance from a G2V star like the Sun would be 1 Astronomical Unit (AU) and the year length would be 365.56 Earth days. The examples range from spectral type M8V stars with masses of 0.082 of the Sun's mass, an orbital distance of 0.0207 AU, and a year 3.28 Earth days long, to spectral type A2V stars with masses of 2.05 the Sun's mass, an orbital distance of 4.611 AU, and a year 2,526.01 Earth days long.
However, it is believed that not all stars within that range of spectral types are capable of having habitable planets.
Stephen H. Dole, in Habitable Planets for Man, 1964, 2007, discussed the requirements for a world to be habitable for humans - or for other lifeforms using liquid water and needing an oxygen rich atmosphere.
Earth had life by about three or four billion years ago, but didn't produce an oxygen rich atmosphere and become habitable for humans until it was about four billion years old. Dole estimated that no planet could become habitable in less than three billion years. And the planet's star would have to remain on the main sequence stage and have a steady luminosity for those three billion years or more or else the large changes in luminosity would wipe out all life on the planet.
On pages 67 to 72 Dole discusses the required properties of the star of a habitable planet. Dole said that astrophysical calculations indicated the most massive stars that could remain on the main sequence stage of development for at least three billion years would be main sequence spectral type F2V stars.
According to the table mentioned above, they would have a mass of 1.44 the Sun's mass, and a planet receiving exactly as much radiation from F2V star as Earth gets from the Sun would have to orbit it at a distance of 2.236 AU with an orbital period or year of 1,018.01 Earth days.
The question of the least massive stars which could have habitable planets depends on the circumstellar habitable zones of stars, which Dole calls "ecospheres". The habitable zones extend from inner edges where planets would be too hot to outer edges where they would be too cold, with planets in between being potentially habitable if other things are right.
The less massive a star is, the less luminous it will be, so the inner and outer edges of its habitable zone will be closer to the star. And the closer a planet is to its star, the stronger the tidal force of the star will be upon the planet. When a palnet is too close to its star, the tidal force will be strong enough to quickly slow the rotation of the planet, so that it will become tidally locked, with one side always facing the star in eternal day and the other side in eternal night. And all the water and air might travel from the day side to the night side and freeze out, leaving the planet uninhabitable.
On pages 71 to 72 Dole calculated that a star could have a full ecosphere or habitable zone if it had a mass of about 0.88 of the Sun's mass, or higher. The inner parts of the habitable zones of stars of lower mass would be too close to the stars and planets in those regions would become tidally locked. A star with a mass of less than 0.72 of the Sun's mass would have a habitable zone that was entirely too close to the star, where any planets would be tidally locked. A mass of 0.72 would correspond to a K1V type star.
According to the table I mentioned earlier, a star with 0.88 the mass of the Sun would be somewhere between a type G8V and a type K2 V, and have a year somewhere between 280.06 and 182.93 Earth days long. A star with 0.72 the mass of the Sun would be somewhere between a K2V star with 0.78 the mass of the Sun and a K5V with 0.68 the mass of the Sun, and thus have a year somewhere between 182.93 and 114.84 Earth days long.
Thus the longest possible length of a habitable planet's year would be between about 3.6 and 8.8 times as long as the shortest possible length of a habitable planet's year.
Part Two: Planets tidally locked to companion worlds instead of to their stars.
On pages 72 to 75 Dole speculates that if a planet has a large enough natural satellite, or is part of a double planet, or is not a planet but a moon of a large planet, it would be tidally locked to the planet and not to the star, and thus might have days short enough to be habitable, even if it orbited a less massive star than 0.72 the mass of the Sun.
But the less massive and dimmer the Star, the closer such a planet would have to obit, and eventually the planet would get so close to the star that the stellar tides upon the planet would be too strong and destructive for habitability. Dole estimated that the lower mass limit for the star in such a situation would be about 0.35 the mass of the Sun.
That would be less massive than a M2V star with 0.44 the mass of the Sun and more massive than a M5V star with 0.16 the mass of the Sun. So that indicates that the shortest possible length of the year of a habitable planet should be between 36.51 Earth days and 11.68 Earth days.
So if this is possible, the longest possible year of a habitable palnet would be between 27.88 and 87.15 times as long as the shortest possible year of a habitable planet.
Part Three: Planets orbiting two or more stars.
However, circumbinary planets orbit orbit around two stars. If the two stars in the binary are identical, and are F2V stars, their combned habitable zone would have inner and outer limits about 1.44 times as far as the limits around one F2V star.
And if there is a quadruple star system with two pairs of F2V stars, and the stars orbit close enough to each other, planets could orbit them in their combined habitable zone, which would have inner and outer limits which would be twice as far as around a single F2V star.
Thus in extreme and very rare cases habitable planets orbiting binary or multiple stars might have years significantly longer than habitable planets orbiting a single F2V star would have.
Part Four: Can Tidally Locked planets be habitable?
But there is more.
The idea that tidally locked planets in the habitable zones of less massive stars can't be habitable has been challenged.
This pessimism has been tempered by research. Studies by Robert Haberle and Manoj Joshi of NASA's Ames Research Center in California have shown that a planet's atmosphere (assuming it included greenhouse gases CO2 and H2O) need only be 100 millibars (0.10 atm), for the star's heat to be effectively carried to the night side. This is well within the levels required for photosynthesis, though water would still remain frozen on the dark side in some of their models. Martin Heath of Greenwich Community College, has shown that seawater, too, could be effectively circulated without freezing solid if the ocean basins were deep enough to allow free flow beneath the night side's ice cap. Further research—including a consideration of the amount of photosynthetically active radiation—suggested that tidally locked planets in red dwarf systems might at least be habitable for higher plants.
Humans require a partial pressure of at least 60 millimeters of mercury (plus small amounts of other gases) to survive. That is about 0.0789 the surface pressure at sea level on Earth. So almost every planet with an atmosphere breathable for humans would have a pressure of at least 0.10 Earth atmosphere, calculated to be sufficient for proper heat circulation on a tidally locked planet. However, that minimum atmosphere necessary for sufficient heat circulation on a tidally locked planet might include too much green house gases like carbon dioxide and water vapor to be breathable for humans, and possibly too much to be breathable for any life forms requiring oxygen.
There are some other problems with habitability of planets of class M red dwarf stars. I once read a science ficiton novel by Andre Norton, set on a planet of a dim red star, where it was said that stars can do bad things to planets which orbit them too closely. And I thought that was silly. Since the planet was orbiting at the proper distance to have a habitable temperature, it didn't matter what its distance from the star was. But later I learned that many dim class M stars are flare stars which sometimes increase their luminosity several times, which would be bad for life on their planets. But not all class M stars are flare stars.
Thus it is possible that there could be planets, habitable for humans and/or for other intelligent beings requiring liquid water and oxygen rich atmospheres, around very dim clas M red dwarfs, possbily orbiting stars as dim as M8V with years 3.82 Earth days long.
Part Five: The inner and outer edges of a star's habitable zone.
But there's more!
A habitable planet doesn't have to orbit its star at the distance necessary to receive exactly as much radiation from its star as Earth gets from the Sun. A planet could get a little more or less radiation than Earth, and be a little hotter or colder on average than Earth, and still be habitable. And so a habitable planet could have a year a little shorter or longer than necessary to receive exactly the same abount of radiation as Earth does, and still remain habitable.
The procedure to calculate the inner and outer edges of a star's habitable zone is simple, if that star's luminosity relative to that of the Sun is known. Simply multiply the distances to the inner and outer edges of the Sun's habitable zone by the square root of the star's luminosity compared to that of the Sun.
So what distances from the Sun are the inner and outer edges of the Sun's habitable zone?
Nobody knows for sure. Here is a link to a collection of a number of different estimated or calculated inner and outer edges, and sometimes both, of the Sun's circumstellar habitable zone, made during the last sixty years.
Note how greatly they differ.
One of the best known calculations, by Hart et al in 1979, gives a very narrow habitable zone, between 0.95 AU and 1.01 AU.
Another well known and often used calculation, by Kasting et al in 1993, gives a much broader conservative habitable zone, between 0.95 AU and 1.37 AU, and an even broader optimistic habitable zone between 0.84 AU and 1.67 AU.
In various estimates the inner edge of the Sun's habitable zone varies from about 0.38 AU to 0.99 AU, and th eouter edge of the Sun's habitable zone varies from about 1.01 AU to about 10 AU.
I note that Dole's estimate is the only one explicitly about habitability for humans and beings with similar requirements. It is possible that all of the other estimates are for planets habitable for carbon based life using liquid water in general, and that none of them consider habitability for humans or for other oxygen breathers.
Some of them seem to require atmospheric compositon which would be unbreathable, for humans or other oxygen breathers, in order to have temperatures suitable for life.
So a writer extremely cautious about their story being proved to be impossible will restrict their circumstellar habitable zones to distances where the radiation received from the star would be equivlaent to that recieved at distances of 0.99 to 1.01 AU from the Sun.
Other writers might imagine that the Sun's circumstellar habitable zone is broader, in line with the estimates of Dole (1964), or Kasting et al (1993), etc. Those would allow for wider circumstellar habitable zones and for greater variation in the year lengths of habitable planets.
Thus I can imagine that such daring writers might have a range of year lengths for habitable planets where the longest one was about a thousand times as long as the shortest one.
Part Six: Alternate Biochemistries.
And a more daring science ficiton writer might imagine that life, including intelligent life, might have different basic biochemisty than Earth life, and could flourish at temperatures much higher or lower than carbon based, liquid water using life could tolerate, thus vastily extendng the range of possible year lengths of habitable and inhabited planets.
Here is a link to an article discussing some hypothetical alternate biochemistries for alien life forms, which may be a good place for a writer interested in using them to start researching.
Part Seven: Conclusion.
So the range of habitable planet year lengths in a science fiction story would mainly depend on how anxoious they are to avoid writing something which may be proved wrong in future millenia, centuries, or decades, or how much they dare to risk being proved wrong in the future.
And in any case the range of year lengths of habitable planets in ficiton is likely to be small compared to the range of year lengths of exoplanets which have already been discovered.