set default expiration time on date input for Sends (#300)

This commit is contained in:
Addison Beck 2021-03-09 10:31:05 -05:00 committed by GitHub
parent 125de0dd47
commit f29afc7cf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -353,6 +353,12 @@ export class AddEditComponent implements OnInit {
this.showOptions = !this.showOptions;
}
expirationDateFallbackChanged() {
this.isSafari ?
this.safariExpirationTime = this.safariExpirationTime ?? '00:00' :
this.expirationTimeFallback = this.expirationTimeFallback ?? this.datePipe.transform(new Date(), 'HH:mm');
}
protected async loadSend(): Promise<Send> {
return this.sendService.get(this.sendId);
}
@ -473,13 +479,13 @@ export class AddEditComponent implements OnInit {
// determine if an unsupported value already exists on the send & add that to the top of the option list
// example: if the Send was created with a different client
if (field === DateField.ExpriationDate && this.expirationDateTimeFallback != null) {
if (field === DateField.ExpriationDate && this.expirationDateTimeFallback != null && this.editMode) {
const previousValue: TimeOption = {
standard: this.datePipe.transform(this.expirationDateTimeFallback, 'hh:mm a'),
military: this.datePipe.transform(this.expirationDateTimeFallback, 'HH:mm'),
};
return [previousValue, {standard: null, military: null}, ...validTimes];
} else if (field === DateField.DeletionDate && this.deletionDateTimeFallback != null) {
} else if (field === DateField.DeletionDate && this.deletionDateTimeFallback != null && this.editMode) {
const previousValue: TimeOption = {
standard: this.datePipe.transform(this.deletionDateTimeFallback, 'hh:mm a'),
military: this.datePipe.transform(this.deletionDateTimeFallback, 'HH:mm'),