The following information is an excerpt from NARA's National Personnel Records Center(NPRC) website that explains eligibility for Veterans Preference:
War Service Creditable for Veterans Preference
In the absence of statutory definition for "war" and "campaign or expedition," OPM considers to be "wars" only those armed conflicts for which a declaration of war was issued by Congress. The title 38, U.S.C., definition of "period of war," which is used in determining benefits administered by the Department of Veterans Affairs, includes the Vietnam Era and other armed conflicts. That title 38 definition is NOT applicable for civil service purposes.
Thus the last "war" for which active duty is qualifying for Veterans preference is World War II. The inclusive dates for World War II service are December 7, 1941, through April 28, 1952.
Please see more at NPRC's website