Hi!
I found myself needing a dfnsParseIso pipe since the dates coming from my server API are ISO-formatted (ie. not localized) and since date-fns 2.0 doesn't supports strings anymore.
import { Pipe, PipeTransform } from '@angular/core';
import { parseISO } from 'date-fns';
@Pipe({
name: 'myDfnsParseIso',
pure: true
})
export class DfnsParseIsoPipe implements PipeTransform {
public transform(value: string, options?: { additionalDigits?: 0 | 1 | 2 }): Date {
return parseISO(value, options);
}
}
Hi! I found myself needing a dfnsParseIso pipe since the dates coming from my server API are ISO-formatted (ie. not localized) and since date-fns 2.0 doesn't supports strings anymore.