In the film:
Tezoro stated that Loffy defeated Doflamingo, and Sabo has the Flair-Flair Fruit's power. That puts the Gold film after their fight with Doflamingo.
After they defeated Doflamingo in the anime, they got separated from each other and Sanji went to his wedding and all that.
So is the film canon? If it is, when does it take place?