API Reference
Class
DatePresenter
A point in time, absolute (in the presenter's or the context's time zone), relative to now, or both. Accepts DateTime, DateTimeOffset and ISO 8601 strings. PresentedValue.Number is the number of days from now (negative in the past), so tone rules can flag, for example, certificates that expire soon. DateTime.MinValue and DateTime.MaxValue (and values within 14 hours of them) show as "never" with no number.
Inheritance
- Object
- DatePresenter
Constructors
public DatePresenter(DateDisplay display = Absolute, String? format = null, TimeZoneInfo? timeZone = null) #Creates a date presenter.
Parameters
- display ConsoleMonster.Presenters.DateDisplay = Absolute
- Absolute, relative or both (default absolute).
- format System.String? = null
- The absolute format (default yyyy-MM-dd HH:mm).
- timeZone System.TimeZoneInfo? = null
- The time zone for absolute dates, or null for the context's.
Methods
public PresentedValue Present(Object? value, PresenterContext context) #Returns:
PresentedValuePresents a value.
Parameters
- value System.Object?
- The raw value (may be null).
- context ConsoleMonster.Presenters.PresenterContext
- Culture, clock, time zone, column statistics and the render context.
Returns
The presented value.
public static String Relative(TimeSpan offset) #Returns:
StringFormats an offset from now: just now, 45 s ago, 3 h ago, in 12 d, 2 y ago.
Parameters
- offset System.TimeSpan
- The value minus now.
Returns
The text.
Inherited Methods
public virtual Boolean Equals(Object? obj) #Returns:
BooleanInherited from Object
Parameters
- obj Object?