I am looking to develop an extension for FormGroup that will convert Persian dates to Gregorian dates. Here is the code I have written for the extension:
import { FormControl } from '@angular/forms'
export { }
declare global {
interface FormControl {
ToMiladidate(date: Date): string;
}
}
FormControl.prototype.ToMiladidate = function (date: Date): string {
if (!date)
return this;
return new Date(date).toISOString();
}
However, I encountered an error on this line:
FormControl.prototype.ToMiladidate
The error message states:
Property 'ToMiladidate' does not exist on type 'FormControl'
What could be causing this issue? How can I resolve it?