I have in component home.ts
myDate: String = new Date().toISOString();
I would like to get the values this date and pass to providers, in console I see
ngOnInit() {
console.log(this.myDate);
output = 2018-05-11T14:28:57.329Z
}
In my country I want to use 11/05/2018
and my method created I have
getForm() {
this.user = this.fb.group({
name: ['', Validators.required ],
...
created_at: this.myDate
})
}
this.auth.createUser(this.setLawyer(), 'lawyers')
.then((result) => {
this.navCtrl.setRoot('LoginPage')
.then(() => {
this.showAlert('Sucesso!', `Você foi cadastrado com sucesso`)
});
}) ;
I created a method to format data before send to providers
setLawyer() {
let lawyer = {
name: this.user.value.name,
date: this.user.value.created_at.date,
hour: this.user.value.created_at.hour,
status: 1,
}
return lawyer;
}