mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
Merge branch 'next/minor' of github.com:Start9Labs/start-os into next/major
This commit is contained in:
19
web/projects/ui/src/app/services/date-transformer.service.ts
Normal file
19
web/projects/ui/src/app/services/date-transformer.service.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { AbstractTuiValueTransformer, TuiDay } from '@taiga-ui/cdk'
|
||||
|
||||
type From = TuiDay | null
|
||||
type To = string | null
|
||||
|
||||
@Injectable()
|
||||
export class DateTransformerService extends AbstractTuiValueTransformer<
|
||||
From,
|
||||
To
|
||||
> {
|
||||
fromControlValue(controlValue: To): From {
|
||||
return controlValue ? TuiDay.jsonParse(controlValue) : null
|
||||
}
|
||||
|
||||
toControlValue(componentValue: From): To {
|
||||
return componentValue?.toJSON() || null
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user