Hard to pinpoint exactly, but if I had to I would say it started in 1896 with the Democratic nomination of William Jennings Bryan, alienating the Bourbon Democrats, and finished in 1964 passage of the Civil Rights Act and the Republican nomination of Goldwater.
Every new responder to this topic should have to read every single word of NC Yankee's posts in this thread.
My opinion is democrats became a truly liberal party(neither party was before 1896) with William Jennings Bryan taking over the party and with exception of Alton Parker , John Davis , and Bill Clinton the have not had a nominee since then who wasn’t a solid liberal
But a "switch" implies a time when the Republican Party was decidedly to the "left" of the Democrats, and given that we can't just place simplistic things like "states' rights" or "racism" on some simplified political spectrum that transcends hundreds of years and several eras (the way we can, arguably, do with class issues, immigration and moralism), this is an assertion that I flatly reject and contend that you have to be - at best - very misinformed to accept.
Yah both parties did not flip (your right about that)
What I think happened was that the Republican party has always been the party of Business and Industry and for the first part of the Industrial Revolution(until say around the mid 1870s) being the party of Industry was considered more "liberal" because the Democratic party was dominated by agrarians which was considered more conservative.
Basically, after that system collapsed the Democrats spent 20 years basically being Republican lite(1876-1896) then Labor and Populists in 1896 decided to basically give up on trying to take over the GOP and move to take over the Dems and they were successful because the dems really didnt have anything strong enough to prevent that from happening(since the agrarians long had been gone by that point).
That basically made the democrats the more leftist party and have been since then.
The GOP though has basically stayed constant the whole time(in their core base)
what? every trump southern deplorable is usually the equivalent of a 1940's dem. Actually, I can't think of a single group of people who have stayed completely loyal to Republicans since the forming of the party, besides whites. Ideologically, Dems have completely flipped, but they still have the same loose coalition, in those who are low income earners. Also, Republicans have always been free market capitalists.