mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-10 00:18:57 +00:00
@@ -1,16 +1,15 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { NgbDateAdapter, NgbDateStruct } from "@ng-bootstrap/ng-bootstrap";
|
||||
import { Injectable } from '@angular/core'
|
||||
import { NgbDateAdapter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap'
|
||||
|
||||
@Injectable()
|
||||
export class ISODateTimeAdapter extends NgbDateAdapter<string> {
|
||||
|
||||
fromModel(value: string | null): NgbDateStruct | null {
|
||||
if (value) {
|
||||
let date = new Date(value)
|
||||
return {
|
||||
day : date.getDate(),
|
||||
month : date.getMonth() + 1,
|
||||
year : date.getFullYear()
|
||||
day: date.getDate(),
|
||||
month: date.getMonth() + 1,
|
||||
year: date.getFullYear(),
|
||||
}
|
||||
} else {
|
||||
return null
|
||||
@@ -18,6 +17,8 @@ export class ISODateTimeAdapter extends NgbDateAdapter<string> {
|
||||
}
|
||||
|
||||
toModel(date: NgbDateStruct | null): string | null {
|
||||
return date ? new Date(date.year, date.month - 1, date.day).toISOString() : null
|
||||
return date
|
||||
? new Date(date.year, date.month - 1, date.day).toISOString()
|
||||
: null
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user