California residency requirements
To file for divorce in California, at least one spouse must have lived in California for the past 6 months and in the county where they're filing for the past 3 months. (Cal. Fam. Code § 2320.)
Both numbers are continuous. If you moved away for two months in the middle of those six, the clock resets.
You only need ONE spouse to meet the residency requirement. Your spouse can live in another state, or even another country, and you can still file in California.
If neither spouse meets residency, you have two options: (1) wait it out, or (2) file in the state where one of you does meet residency. California won't take the case otherwise.
Common miscounts we see: people count the month they moved in as a full month (it doesn't count if it was the 15th); people count brief work travel out of state as gaps (it usually doesn't — your domicile didn't change); people forget the 3-month county rule and file in the wrong county.