DateConstantExtensions extension

DateConstantExtensions is an extension on the DateTime class in Dart. It provides additional properties for performing operations on DateTime instances.

The isUnixEpochDate property checks if the year, month, and day of the DateTime instance match those of the Unix epoch date (January 1, 1970).

The isUnixEpochDateTime property checks if the DateTime instance is exactly equal to the Unix epoch date and time (00:00:00 UTC, January 1, 1970).

Example usage:

DateTime date = DateTime.utc(1970, 1, 1);
bool isEpochDate = date.isUnixEpochDate;  // returns true
bool isEpochDateTime = date.isUnixEpochDateTime;  // returns true
on

Properties

isUnixEpochDate bool

Available on DateTime, provided by the DateConstantExtensions extension

Checks if the year, month, and day of the DateTime instance match those of the Unix epoch date (January 1, 1970).
no setter
isUnixEpochDateTime bool

Available on DateTime, provided by the DateConstantExtensions extension

Checks if the DateTime instance is exactly equal to the Unix epoch date and time (00:00:00 UTC, January 1, 1970).
no setter