Skip to content

Enhancement: Write conversion policy for locale-aware date formatting on write operations #17

@wagnert

Description

@wagnert

Problem

SOSO-439 solved locale-aware validation (reading/accepting locale-formatted dates). However, the library currently sends dates in ISO 8601 format when writing (add/update). While AppSheet tolerates this when Properties.Locale is set, there is no active conversion to the locale-specific format.

Proposed Solution

Implement a WriteConversionPolicyInterface (Strategy Pattern) that optionally converts field values to locale-specific formats before sending them to the AppSheet API.

Architecture

  • Strategy Pattern analogous to UnknownFieldPolicyInterface
  • Interface: WriteConversionPolicyInterface with apply() method
  • Built-in Implementations:
    • NoOpWriteConversionPolicy (default, backward-compatible)
    • LocaleWriteConversionPolicy (converts ISO dates to locale format)
  • Injection: Via DynamicTable/DynamicTableFactory constructor
  • Write Path: unknownFieldPolicy → validate → writeConversion → client.add()

Scope

Phase 1: Date, DateTime, ChangeTimestamp fields
Phase 2 (future): Percent, Price, Time, Duration (requires API research)

Key Decisions

  1. Strategy Pattern over simple flag — consistent with existing architecture, extensible
  2. Conversion happens after validation — ensures only valid values are converted
  3. Default is NoOp — no breaking change, explicit opt-in required
  4. Builds on getLocaleDateFormat() from SOSO-439 for conversion logic

Related

  • Follows from SOSO-439 (locale-aware validation)
  • Uses architectural patterns from SOSO-435 (UnknownFieldPolicyInterface)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions