putDate method

BatchEventData putDate(
  1. String key,
  2. DateTime value
)

Add a DateTime attribute for the given key.

The attribute key should be a string composed of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.

Date attribute values are sent in UTC to Batch. If you notice that the reported time may be off, try making an UTC DateTime for consistency.

Implementation

BatchEventData putDate(String key, DateTime value) {
  if (_validateAttributeKey(key)) {
    _attributes[key.toLowerCase()] = TypedAttribute(
        type: TypedAttributeType.date,
        value: value.toUtc().millisecondsSinceEpoch);
  }
  return this;
}