Renamed prefixes in angular.json
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This commit is contained in:
14
projects/common/src/fm/services/date-adapter.service.ts
Normal file
14
projects/common/src/fm/services/date-adapter.service.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Component, Injectable } from '@angular/core';
|
||||
import { NgbDateAdapter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';
|
||||
|
||||
@Injectable()
|
||||
export class NgbDateNativeAdapter extends NgbDateAdapter<Date> {
|
||||
|
||||
fromModel(date: Date): NgbDateStruct {
|
||||
return (date && date.getFullYear) ? {year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate()} : null;
|
||||
}
|
||||
|
||||
toModel(date: NgbDateStruct): Date {
|
||||
return date ? new Date(Date.UTC(date.year, date.month - 1, date.day)) : null;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user