A judge has to decide under all of the facts and circumstances, and there is almost no appellate law on point to guide this decision.
The lack of binding appellate precedents is because a judicial decision to grant or deny an ex parte order for injunctive relief pending a hearing on preliminary injunction is not a decision that is subject to appellate review. A failure to hold any hearing after ex parte relief has been granted, or a ruling either way on a preliminary injunction following a hearing, however, is subject to appellate review, so there is much more case law on these issues.
If you ask for an ex parte order, the court could decide to instead hold a hearing first if the request doesn't seem sufficiently urgent to the judge.
As a rule of thumb, two or three weeks is almost never urgent enough to justify an ex parte order, and judges like to hold hearings if they can if the other side's lawyer can be identified and scheduled in for a hearing promptly enough to prevent the issue from becoming moot.
When there is a government defendant, that already has a lawyer who is usually available for emergency matters on short notice, a judge will be more reluctant to grant an ex parte order than in a case with a private defendant with no counsel retained already in relation to the case.
Another factor is the amount of time that would be required to comply with an order if one was issued. The longer it would take to comply, the more immediate the issue becomes.
The time frame in the question could go either way, depending upon the judge.