You will be considered a United States resident for tax purposes if you meet the substantial presence test for the calendar year. To meet this test, you must be physically present in the United States (U.S.) on at least:
31 days during the current year (2019), and
183 days during the 3-year period that includes the current year and the 2 years immediately before that, counting:
All the days you were present in the current year (2019), and
1/3 of the days you were present in the first year (2018) before the current year, and
1/6 of the days you were present in the second year (2017)before the current year.
If you calculate 183 days or more that you were in the US and you moved out of the US sometime in 2019, your default last day is December 31, 2019 and you need to prepare full year resident return.
As a resident, you will need to declare your worldwide income for calendar year 2019. If you have foreign income, you will need to include that in your income. You can use the foreign tax credit on your US tax return to help offset double taxation.
**Mark the post that answers your question by clicking on "Mark as Best Answer"
Hi - I am in similar situation. I was working on H1 since 2012. However, I left US on 27-JUL-2019 and moved to Canada. I pass substantial presence test but I was not in US on last day of year 2019. Can I still file tax as US resident ? Also, can someone point me to part of IRS publication 519 which talks speficifically about my situation ?