Format Date as MM/DD/YYYY in TypeScript

Convert Date format to MM-dd-yyyy in Typescript

While working on a TypeScript project, I needed to display dates in the American format (MM/DD/YYYY) instead of the default ISO format (YYYY-MM-DD). TypeScript’s built-in Date object and the toLocaleString() method make this easy and no external libraries required. In this blog, I’ll show you how to format date as MM/DD/YYYY in TypeScript using toLocaleString(), … Read more >>

Type vs Interface in TypeScript

Type vs Interface in TypeScript

TypeScript, a superset of JavaScript, introduces static typing to the JavaScript ecosystem, enabling developers to catch errors early and write more maintainable code. Among the powerful features of TypeScript are types and interfaces, both of which allow you to define the shape of an object. However, choosing between them can be confusing for newcomers. In … Read more >>

Subtract Days From a Date in TypeScript

Subtract days from date in Typescript using library

Recently, while working on a TypeScript project, I needed to find a date a few days before an important event, like when to start preparing or send reminders. If I had changed the dates directly, it could have caused issues in the code. So, I created a reusable function that subtracts days using TypeScript’s Date … Read more >>

Use TypeScript Enums as Object Keys

Use TypeScript Enums as Object Keys

While working on a TypeScript project, I needed to store values in an object where the keys represented different user roles, such as Admin, Editor, and Viewer. Instead of using plain strings (which can cause typos or mistakes), I used a TypeScript enum to define the roles. This made the code more readable, safer, and … Read more >>

Add Days to a Date in TypeScript

Add days to future date in Typescript

When I was working on a TypeScript project recently, I needed to calculate dates a few days ahead, like setting deadlines or scheduling reminders. At first, I wasn’t sure how to easily add days to a date without messing up the original date or dealing with complex date math. To solve this, I created a … Read more >>

Check If a Key Exists in a TypeScript Object

Check If a Key Exists in a TypeScript Object

While working on a TypeScript project, you receive data from an API as an object. Before using any property from that object, you want to make sure the key actually exists to avoid errors. For example, you want to display the user’s email, but you’re not sure if the email key is present in the … Read more >>

Sort Arrays by Date in TypeScript

Sort Array Dates in Descending Order in TypeScript

When I was working on a TypeScript project recently, I had to display a list of events sorted by their dates. I used .sort() to arrange them, but it didn’t work as expected because the dates were a mix of strings and Date objects. To fix this, I converted all the date values to Date … Read more >>

Convert a TypeScript Enum to an Array

Convert Enum into Array in TypeScript

When working with enums in TypeScript, you may encounter situations where you need to convert an enum to an array. This can be useful when creating a select box or iterating over the enum values. In this tutorial, we will learn how to convert a TypeScript enum to an array. I will explain different methods, … Read more >>

Add Seconds to Date in TypeScript

Adding Seconds to a Date in Typescript

When we work with dates and times in TypeScript, even a small adjustment, like adding a few seconds, can avoid plenty of code corrections later. In this Typescript tutorial, we will start with a simple Date object and show you how to push it forward by the exact number of seconds you need. Whether you are … Read more >>

TypeScript Class vs Interface Explained with Examples

TypeScript Class vs Interface Explained with Examples

TypeScript, a superset of JavaScript, enhances the language with static types, making it a powerful tool for building large-scale applications. Two fundamental concepts in TypeScript are classes and interfaces. Understanding when and how to use them is crucial for writing clean, maintainable code. In this tutorial, we will understand the TypeScript class vs interface, explain … Read more >>

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.