How to Get Tomorrow’s Date in TypeScript

While building a minor feature in our internal HR tool, I had to show the date for the next day based on user actions. Since we’re using TypeScript for the frontend, I looked into a few clean and reliable ways to calculate tomorrow’s date.

In this tutorial, I’ll explain how to get tomorrow’s date in TypeScript, with real-time examples.

Understanding the Date Object in TypeScript

First, let’s understand the Date object in TypeScript. The Date object provides methods for working with dates and times. It allows you to create, manipulate, and format dates according to your requirements.

To create a new Date object representing the current date and time, you can simply use the Date() constructor without any arguments. For example:

const currentDate = new Date();
console.log(currentDate); // Output: Current date and time

Check out: How to Set a Date Value to Null in TypeScript

Calculating Tomorrow’s Date

Now that we have a basic understanding of the Date object, let’s explore different approaches to calculating tomorrow’s date.

Method 1: Using the setDate() Method

One straightforward approach to get tomorrow’s date is by using the setDate() method of the Date object. This method allows you to set the day of the month for a given Date instance. By passing the result of getDate() + 1, you can set the date to tomorrow.

Here’s an example:

const today = new Date();
const tomorrow = new Date(today);
tomorrow.setDate(today.getDate() + 1);
console.log(tomorrow); // Output: Tomorrow's date

Output:

Get tomorrow's date in Typescript

In this example, we first create a Date object representing today’s date. Then, we create a new Date object tomorrow based on today. By calling setDate() with today.getDate() + 1, we increment the day by one, effectively setting tomorrow to the next day.

Check out: Check Invalid Dates in TypeScirpt

Method 2: Adding One Day to the Current Date

Another approach to calculate tomorrow’s date is by adding one day (24 hours) to the current date. We can achieve this by using the getTime() method, which returns the number of milliseconds since January 1, 1970.

Here’s an example:

const today = new Date();
const tomorrowTimestamp = today.getTime() + 24 * 60 * 60 * 1000; // Adding one day in milliseconds
const tomorrow = new Date(tomorrowTimestamp);
console.log(tomorrow); // Output: Tomorrow's date

Output:

fetch tomorrow date using getTime() in typescript

In this example, we start with today’s date and calculate the timestamp for tomorrow by adding the number of milliseconds in a day (24 hours * 60 minutes * 60 seconds * 1000 milliseconds) to today’s timestamp. Finally, we create a new Date object tomorrow using the calculated timestamp.

Check out: How to Get the Current Date in Milliseconds Using TypeScript

Formatting Tomorrow’s Date

Once we have tomorrow’s date, we often need to format it in a specific way. TypeScript provides the toLocaleDateString() method to format dates according to the user’s locale.

Here’s an example of formatting tomorrow’s date in the “MM/DD/YYYY” format commonly used in the United States:

const today = new Date();
const tomorrow = new Date(today);
tomorrow.setDate(today.getDate() + 1);
const formattedDate = tomorrow.toLocaleDateString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit' });
console.log(formattedDate); // Output: Formatted date (e.g., "05/17/2025")

Output:

Typescript method to get tomorrow's date

In this example, we use the toLocaleDateString() method with the ‘en-US’ locale and specify the desired format options. The year, month, and day options are set to ‘numeric’ and ‘2-digit’ to ensure a consistent format.

Check out: Get the Current Date in TypeScript

Handling Edge Cases

When working with dates, it’s important to consider edge cases and handle them appropriately. For example, when calculating tomorrow’s date, you need to account for the last day of the month, as incrementing the day might result in an invalid date.

Here’s an example that demonstrates how to handle such cases:

const today = new Date('2025-03-31');
const tomorrow = new Date(today);
tomorrow.setDate(today.getDate() + 1);
console.log(tomorrow); // Output: "2025-04-01" (April 1st, not March 32nd)

Output:

calculate tomorrow's date in typescript

In this example, we set today to March 31st, 2025. When incrementing the day to calculate tomorrow’s date, JavaScript automatically adjusts the date to April 1st, 2025, since March 32nd is an invalid date.

Conclusion

In this tutorial, we covered multiple ways to get tomorrow’s date in TypeScript using setDate(), adding milliseconds, and formatting with toLocaleDateString(). We also looked at how TypeScript handles edge cases like month-end transitions. These techniques help you work confidently with future dates in various project scenarios, whether it’s scheduling tasks or displaying upcoming events.

I hope this guide has been helpful in explaining how to get tomorrow’s date in TypeScript. Feel free to explore further and experiment with different date manipulation techniques to suit your project’s requirements.

You may also like to read:

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.