eclipsesource / eclipsesource/jsonforms

support for date-time control in Angular

Open
#1,921 1 comment 0 reactions 0 assignees View on GitHub
angular material
Dominant language
TypeScript
Stars
2.7k
Forks
424
Avg merge
17d 8h
Merged PRs (30d)
1

Description

### Is your feature request related to a problem? Please describe.

Hi, there is missing a support for date-time control in Angular. There is for date and time but date-time is missing.

### Describe the solution you'd like

I have created something like this like a workaround.

```
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
import { and, isStringControl, optionIs, Tester } from '@jsonforms/core';

export const dateTimeControlTester: Tester =
and(isStringControl, optionIs('format', 'date-time'));

@Component({
selector: 'DateTimeControlRenderer',
templateUrl: './datetime-control.renderer.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class DateTimeControlRenderer extends JsonFormsControl {

constructor(jsonformsService: JsonFormsAngularService) {
super(jsonformsService);
}

public getEventValue = (event: any) => new Date(event.target.value).toISOString();

}
```

```

{{ label }}



{{ description }}
{{ error }}

```

### Describe alternatives you've considered

I couldn't find any alternative to the custom renderer.

### Framework

Angular

### RendererSet

Material

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.