To my eye, that's the Republic of Texas national flag (identical to the modern version), adopted in Jan 1839.
So, no earlier than that.
And I guess technically, you can rule out years 1840 for having a different flag (Republic of the Rio Grand flag, at least in Laredo), and the Civil War years of 1861-1865 which had the 7 stars and 3 stripes.
And, since there's no Haagen-Dazs ice cream shop in the painting, no later than about 1977.![]()