changed style and used flatpickr calendar
This commit is contained in:
1 parent
1425f0e425
commit
e03e887f76
3 files changed
+39
-63
No files matched your search
@@ -1,10 +1,5 @@
|
||||
import { Component, Inject, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { UserCollectionService } from '../../../../core/services/userCollection.service';
|
||||
import { NotificationPopupComponent } from '../../notification-popup/notification-popup.component';
|
||||
import { NotificationService } from '../../../services/notification.service';
|
||||
import { UserCollection } from '../../../models/userCollection.model';
|
||||
|
||||
import {
|
||||
trigger,
|
||||
@@ -14,6 +9,7 @@ import {
|
||||
animate,
|
||||
} from '@angular/animations';
|
||||
import { formatDate } from '@angular/common';
|
||||
import flatpickr from 'flatpickr';
|
||||
|
||||
@Component({
|
||||
selector: 'app-seen-modal',
|
||||
@@ -48,11 +44,22 @@ export class SeenModalComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.data == null) {
|
||||
this.watchDate = formatDate(new Date(), 'yyyy-MM-dd', 'en-US');
|
||||
return; // ? no initial data was passed
|
||||
// ? no initial data was passed: populate date field with current date
|
||||
this.watchDate = formatDate(new Date(), 'MMM dd, yyyy', 'en-US');
|
||||
} else {
|
||||
// ? if data is passed, populate fields
|
||||
this.watchDate = this.data.watchDate.dateFormat('yyyy-MM-dd');
|
||||
this.watchedWith = this.data.watchedWith.split(', ').join('\n');
|
||||
}
|
||||
this.watchDate = this.data.watchDate.toString().substring(0, 10);
|
||||
this.watchedWith = this.data.watchedWith.split(', ').join('\n');
|
||||
|
||||
flatpickr('#myDatepicker', {
|
||||
inline: true,
|
||||
defaultDate: this.watchDate,
|
||||
altInput: true,
|
||||
allowInput: false,
|
||||
altFormat: 'F j, Y',
|
||||
dateFormat: 'Y-m-d',
|
||||
});
|
||||
}
|
||||
|
||||
onConfirm(): void {
|
||||
|
||||
Reference in new issue
Block a user