The TimeSpan
class is a utility for managing and manipulating time intervals in TypeScript/JavaScript. It provides a simple, object-oriented way to perform arithmetic and comparison operations on time spans. This class can be used to represent durations in milliseconds, seconds, minutes, hours, or days.
- Creation Methods: Create
TimeSpan
objects from various inputs (current time,Date
objects, milliseconds, seconds, minutes, hours, or days). - Conversion Methods: Convert a
TimeSpan
to milliseconds, seconds, minutes, hours, or days. - Arithmetic Operations: Add, subtract, multiply, and divide
TimeSpan
objects. - Comparison Methods: Compare
TimeSpan
objects using equality, less than, greater than, etc. - Time Checks: Check if the
TimeSpan
represents a past or future time.