Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
// ✅ Set the date using separate date/time virtural fields:
$object->SetDBField('FieldName_date', 1721215210);
$object->SetDBField('FieldName_time', 1721215210);
$object->Update(); // The 'FieldName' field now has combined value of _date/_time fields.

// ✅ Set the date using the database field/_combined virtual field:
$object->SetDBField('FieldName', 1721215210);
$object->SetDBField('FieldName_combined', 1);
$object->Update(); // The _date/_time fields aren't used.

// ❌ Set the date using the database field only:
$object->SetDBField('FieldName', 1721215210);
$object->UpdateFormattersSubFields(array('FieldName'));
$object->Update(); // The _date/_time fields are set from the 'FieldName' field.

// ❌ Sets the credit card expiration using the database field.
$object->SetDBField('CreditCardExpiration', '05/24');
$object->UpdateFormattersSubFields(array('CreditCardExpiration'));
$object->Update(); // The _month/_year fields are set from the 'CreditCardExpiration' field.

All solutions work when setting a non-empty value. However, the later 2 solutions don’t work, when there is a need to clear a field marked with the ❌ sign don’t allow for clearing the field's existing value.

Solution

Update the “\kDateFormatter::UpdateSubFields” and “\kCCDateFormatter::UpdateSubFields” methods method to support empty values.

Related Tasks

Jira Legacy
serverSystem Jira
serverId513b375f-8291-3313-9d9f-704c39b1f915
keyINP-1886