Data Transformer Date-serialize

Edit on GitHub

This document explains the Data Transformer Date-serialize service in the Components Library.

Overview

Data Transformer Date-serialize is an Angular Service that serializes JS Date Object into a Date ISO string.

In the example below, the datasource transforms date object into the serialized date string.

<spy-select
    [datasource]="{
        type: 'inline',
        data: Date.now(),
        transform: {
            type: 'date-serialize'
        },
    }"
>
</spy-select>

Service registration

Register the service:

@NgModule({
    imports: [
        DataTransformerModule.withTransformers({
            'date-serialize': DateSerializeDataTransformerService,
        }),
    ],
})
export class RootModule {}

Interfaces

Below you can find interfaces for the Data Transformer Date-serialize:

declare module '@spryker/data-transformer' {
    interface DataTransformerRegistry {
        'date-serialize': DateSerializeDataTransformerConfig;
    }
}

export interface DateSerializeDataTransformerConfig extends DataTransformerConfig {}