Class VBDateType
A VBIntrinsicType<T> representing the Date data type.
public sealed record VBDateType : VBIntrinsicType<DateTime>, IEquatable<VBType>, IEquatable<VBIntrinsicType>, IEquatable<VBIntrinsicType<DateTime>>, IEquatable<VBDateType>
- Inheritance
-
VBDateType
- Implements
- Inherited Members
- Extension Methods
Remarks
The managed type of a value of this data type is DateTime.
👉 Date values are also representable as a double via SerialValue (OLE Automation/OADate value).
Constructors
VBDateType()
A VBIntrinsicType<T> representing the Date data type.
public VBDateType()
Remarks
The managed type of a value of this data type is DateTime.
👉 Date values are also representable as a double via SerialValue (OLE Automation/OADate value).
Fields
MaxSerial
The maximum valid value for a DateSerial.
public const double MaxSerial = 2958465.999998843
Field Value
Remarks
Corresponds to 9999-12-31T23:59:59Z
MinSerial
The minimum valid value for a DateSerial.
public const double MinSerial = -657434
Field Value
Properties
DefaultValue
Gets the default value for this data type.
public override VBTypedValue DefaultValue { get; }
Property Value
Remarks
⚠️ Derived types must back the implementation of this property with a thread-safe private static readonly Lazy<T>.
Failure to do so would lock up the static context initialization of the StaticSymbol symbols.
MaxValue
Gets the maximum representable value for this data type.
public static VBDateValue MaxValue { get; }
Property Value
MinValue
Gets the minimum representable value for this data type.
public static VBDateValue MinValue { get; }
Property Value
TypeInfo
The Date data type.
public static VBDateType TypeInfo { get; }
Property Value
Zero
Gets the value 0 (zero) representation of this data type.
public static VBDateValue Zero { get; }
Property Value
Methods
CreateValue(IBindingHandle)
Creates a value of this type bound to handle.
public override VBTypedValue CreateValue(IBindingHandle handle)
Parameters
handleIBindingHandle
Returns
Remarks
The base implementation throws: only types that can hold a runtime value override this
(matches the intent of the removed VBTypedValueFactory.CreateValue(VBType) switch,
which returned null for the rest).
IsValidSerial(double)
Whether a Date holds serial: any serial strictly between -657435 and 2958466, a time of day from 100-01-01 to
9999-12-31, which is wider than MinSerial and MaxSerial by the fractions of a second past them (MS-VBA, recorded in
Excel). A value past either end is not a Date: converting it to one, or a Date operation that yields it, is run-time error 6,
Overflow.
public static bool IsValidSerial(double serial)
Parameters
serialdoubleThe serial (
Double) representation of a date.