The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Yahoo::Marketing::DateTimeAccessor - provides a tweak to Class::Accessor's set method to handle date time fields specially

SYNOPSIS

This module is used by the complex types to provide special setter functionality for *Date and *Timestamp fields. It inherits from Class::Accessor::Chained, and overrides the set method to do the following:

If a field appears to be a Date field or Timestamp field, the value passed in is turned into a DateTime object if it's a string, otherwise we assume it's a DateTime object and just ensure that the formatter is set appropriately. DateTime with their formatter set properly should stringify correctly, so this behavior should be pretty transparent to users.

You can use DateTime objects if you like, or use strings, and it should "just work".

CAVEATS

Timestamp fields in EWS are returned with nanoseconds. DateTime::Format::ISO8601 has support for parsing dates in this format, but it cannot print them. Therefore, the returned DateTime objects use DateTime::Format::W3CDTF as a formatter, which will not print the nanosecond portion of the DateTime. If you need nanosecond support, please file an RT bug and some solution will be found (probably providing a way to turn off automatic date/timestamp handling all together).

METHODS

set

Overrides the set method in Class::Accessor to provide automatic date/timestamp handling. See SYNOPSIS above.