@ki32 wrote:
Hi there,
I’m trying add actives to firebase, pull them and display in my angular calendar. However, it complains on date format. I’m trying to format it such as new Date(my_date). However, it’s not pushing this format to firebase this way…
As you can see required format is start: Sat Apr 07 2018 00:00:00 GMT+0100 (GMT Summer Time)
I have: "2018-04-07T18:37:00Z"
My method for pushing at this moment:
addEvent(event: CalendarEvent) { this.afDatabse.list(`/events/`).push({ start: event.start, end: event.end, title: event.title, color: 'test', allDay: event.allDay })
CalendarEvent interface:
import { EventColor } from "./EventColor"; import { EventAction } from "./EventAction"; export interface CalendarEvent { start: any; end?: any; title: string; color: EventColor; actions?: EventAction[]; allDay?: boolean; }
My html:
<ion-item> <ion-input type="text" placeholder="Title" [(ngModel)]="events.title"></ion-input> </ion-item> <ion-item> <ion-label>From:</ion-label> <ion-datetime displayFormat="HH:mm DD/MM/YYYY " pickerFormat="MMM D:HH:mm" [(ngModel)]="events.start"></ion-datetime> </ion-item> <ion-item> <ion-label>To:</ion-label> <ion-datetime displayFormat="HH:mm DD/MM/YYYY " pickerFormat="MMM D:HH:mm" [(ngModel)]="events.end"> </ion-datetime> </ion-item> <ion-item> <ion-label>All Day?</ion-label> <ion-checkbox [(ngModel)]="events.allDay"></ion-checkbox> </ion-item>
Posts: 5
Participants: 3