mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[APPS-2108] break direct dependency on moment.js (#9032)
* break direct dependency on moment.js * [ci:force] preserve moment for cli tools * remove MatMomentDatetimeModule from content * share dialog fixes * revert testing module changes * remove incorrect date modules * fix html
This commit is contained in:
@@ -17,9 +17,13 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { DateAdapter } from '@angular/material/core';
|
||||
import moment, { isMoment, Moment } from 'moment';
|
||||
import { UserPreferencesService, UserPreferenceValues } from '../services/user-preferences.service';
|
||||
|
||||
// Stub for the moment.js integration.
|
||||
// While this dependency is no longer used by the libraries, the moment adapter can still discover the moment.js linked to the application
|
||||
declare let moment: any;
|
||||
type Moment = any;
|
||||
|
||||
/**
|
||||
* @deprecated this class is deprecated and should not be used.
|
||||
* Consider using `AdfDateFnsAdapter` or `AdfDateTimeFnsAdapter` instead
|
||||
@@ -183,7 +187,7 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
|
||||
if (first == null) {
|
||||
// same if both null
|
||||
return second == null;
|
||||
} else if (isMoment(first)) {
|
||||
} else if (moment.isMoment(first)) {
|
||||
return first.isSame(second);
|
||||
} else {
|
||||
const isSame = super.sameDate(first, second);
|
||||
|
@@ -16,14 +16,15 @@
|
||||
*/
|
||||
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import moment, { Moment } from 'moment';
|
||||
|
||||
declare let moment: any;
|
||||
|
||||
/**
|
||||
* @deprecated this pipe is deprecated and should no longer be used
|
||||
*/
|
||||
@Pipe({ name: 'adfMomentDate' })
|
||||
export class MomentDatePipe implements PipeTransform {
|
||||
transform(value: moment.MomentInput, dateFormat: string): Moment {
|
||||
transform(value: any, dateFormat: string): any {
|
||||
return moment(value, dateFormat);
|
||||
}
|
||||
}
|
||||
|
@@ -16,17 +16,14 @@
|
||||
*/
|
||||
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import moment, { Moment } from 'moment';
|
||||
declare let moment: any;
|
||||
|
||||
/**
|
||||
* @deprecated this pipe is deprecated and should no longer be used
|
||||
*/
|
||||
@Pipe({ name: 'adfMomentDateTime' })
|
||||
export class MomentDateTimePipe implements PipeTransform {
|
||||
transform(value: moment.MomentInput, dateFormat: string): Moment {
|
||||
return moment(value, dateFormat)
|
||||
.add(
|
||||
moment(value, dateFormat).utcOffset(),
|
||||
'minutes');
|
||||
transform(value: any, dateFormat: string): any {
|
||||
return moment(value, dateFormat).add(moment(value, dateFormat).utcOffset(), 'minutes');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user