Parses a string timestamp to create a PGTime instance. The timestamp should be in 24-hour format, with
e.g., the string "13" will be treated the same as "13:00:00.000"
Constructor will throw a TypeError if provided with a bad timestamp
The hour part of the timestamp
The millisecond part of the timestamp
The minute part of the timestamp
A static RegExp that matches a wide range of 24-hour HH:MM:SS.mmm formatted timestamps
The second part of the timestamp
A regex that strictly matches against the postgres format, for validation
Get the unpadded hour for display in 12-hour format
Show the hour:minute with AM/PM
Returns an AM/PM formatted hour heading
Display the timestamp without seconds or milliseconds, as used in an input element
Get just the AM/PM portion of the timestamp, for rendering in 12 hour format
Converts the time into the number of milliseconds that have elapsed since midnight before. Used for comparisons.
Determine if this time occurs after another instance
Determine if this time occurs before another instance
Determine if this time is the same as another instance
Display the timestamp in the original format
Attempts to parse an AM/PM style timestamp into a PGTime instance. This may not cover every possible format, but should hit most of our use cases.
Static method to convert a given timestamp to Display format (i.e. 12 hour AM/PM time). It's just a wrapper around
new PGTime(<timestamp>).displayTime
but it returns null for falsy values (e.g. null, undefined, ''), where the constructor would throw an error
Generated using TypeDoc
A utility class to simplify handling timestamps generated from Postgres. Provides helpers for time comparisons, and formatting.