In the United States, from the first time you publicly disclosed it or ‘offered it for sale’ in any way, you have one year to file an application for patent.
If you miss that date, anything that was disclosed or offered for sale is barred from ever receiving a patent. However, improvements you may make to the invention that have not been publicly available or for sale for more than one year are not barred, and may be patentable.
Note, however, that “experimental use” is typically not considered a “public disclosure” if the invention is not yet ‘ready to patent’ and you are still testing it. This can be a very tricky exemption, and it is best to seek competent counsel before relying on it.
Best Practice: File a patent application before disclosing your invention to anyone. If you disclose it, don’t panic: file a patent application (such as a provisional patent application) BEFORE one year.