Angular 6 Material – MatDatePicker italian format dd/MM/yyyy

Material Angular is very very useful library to generate beautiful app with material design and use all the power of angular.
Today we can see how to set the format for the MatDatePicker with dd/MM/yyyy so how to customize it, then you can change it.

In our Angular 6 project we must to install moment.
So execute in our project directory:

npm i @angular/material-moment-adapter 
npm add moment

Then we must to open our

//Some import before, add this 
import {
} from '@angular/material';
import {
} from '@angular/material-moment-adapter';
//create our cost var with the information about the format that we want 
export const MY_FORMATS = {
    parse: {
        dateInput: 'DD/MM/YYYY',
    display: {
        dateInput: 'DD/MM/YYYY',
        monthYearLabel: 'MM YYYY',
        dateA11yLabel: 'DD/MM/YYYY',
        monthYearA11yLabel: 'MM YYYY',
//in our ngmodule providers add the provide for the date 
    imports: [............],
    providers: [{
            provide: MAT_DATE_LOCALE,
            useValue: 'it'
        //you can change
        useValue {
            provide: DateAdapter,
            useClass: MomentDateAdapter,
            deps: [MAT_DATE_LOCALE]
        }, {
            provide: MAT_DATE_FORMATS,
            useValue: MY_FORMATS
    bootstrap: [AppComponent]
export class AppModule {}

At the end all the date in our project became with the format dd/mm/yyyy!!
Some question contact me.

Angular 6 – IE 11 method fill not supported

You have created your angular app and now you have some error about method fill, for example: “Object doesn’t support property or method ‘fill'”.
Line that fail:

var HEADER_FILLER = new Array(HEADER_OFFSET).fill(null); (Angular core).

Don’t worry the solution is easy. You must open your file on: src/polyfill.ts
At line 21 of the file you see:

/** IE9, IE10 and IE11 requires all of the following polyfills. **/

and many “import ‘core-js/es6/BLABLA’” commented.

You must to uncomment all:

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';

Build and fun!

Complete Guide Ionic 3 Firebase with cordova plugin firebase

Okay let’s start to integrate in our Ionic 3 app the Firebase Google Cloud Message with the cordova plugin firebase.
In the Ionic 3 we can found the native integration with this plugin. For the documentation click here.
It work with IOS 10 and IOS 11 and latest version of Android, i have tested it.

In this guide we can see:
Install cordova plugin firebase on Ionic app
Setting cordova plugin firebase on Ionic app
Setting Firebase Cloud Message

Install the Ionic Firebase module

We must to install the npm library and the cordova plugin so let’s start to execute this command:

$ ionic cordova plugin add cordova-plugin-firebase 
$ npm install --save @ionic-native/firebase

Then we must to use it on our app, so let’s start to include it in our app.module.ts, import it and then add into “providers” section.

import { Firebase } from '@ionic-native/firebase'; 
declarations: [ MyApp ], 
imports: [ BrowserModule, HttpClientModule, 
loader: { provide: TranslateLoader, useFactory: (createTranslateLoader), deps: [HttpClient] } 
IonicModule.forRoot(MyApp,{ menuType: 'push' }),IonicStorageModule.forRoot()], 
bootstrap: [IonicApp], 
entryComponents: [ MyApp ], 
providers: [ Api, Items, User, Camera, SplashScreen, StatusBar, Firebase, IonicErrorHandler, { provide: Settings, useFactory: provideSettings, deps: [Storage] },
development { provide: ErrorHandler, useClass: MyErrorHandler } ] })

Setting cordova plugin firebase on Ionic app

Now we can use it in our app.component.ts, for the grant permission, registration of token.
This is a simplest installation, import it, add in the constructor, and then use this.firebase to attach at the event.

For IOS is very important the method “grantPermission”

import {
} from '@ionic-native/firebase';
constructor(platform: Platform, private statusBar: StatusBar, private splashScreen: SplashScreen, private firebase: Firebase) {
    platform.ready().then(() => {
        this.firebase.getToken().then(token => console.log('The token is ${token}')).catch(error => console.error('Error getting token', error));
        this.firebase.onTokenRefresh().subscribe((token: string) => console.log('Got a new token ${token}'));

Now we must to setting up the account on the firebase cloud messaage, so we can generate two files:
google-services.json (Android)
GoogleService-Info.plist (IOS)

We can add this file in the root directory, with the config.xml and package.json file.

Setting Firebase Cloud Message

To setting up the firebase account remind to this guide:

Remember, is very important that you upload you APN CERTIFICATE IOS, if you not load it the notifications not work.
This guide:


If you have some question write me.

LINQ on Nodejs With node-linq

In this days that i have some free time on my “drawing realtime app” project, i have added a managment of the object with the linq.

In c# i use even the linq, but in javascript this is the first time that i use it with success.
Because i have tested some some some times ago but with big object is obviously slow, is even “client side”.

But now with nodejs i can use the linq “server side”, i have seen some library but in my opinion the best is node-linq created by the wearefractal.
Is fast, the docs are good (but they can insert more).

For example i have used it for extract all the action taken in a “drawing room”, for the date i have used timestamp:

var arrRoom = new LINQ(registerRoomAction).Where(function(roomAction) { return ( == && > singleClient.lastupdate && < now); }).OrderBy(function(roomAction) {return;}).Select(function(roomAction) {return;}).ToArray();


So if you want to exract only an item you can use Single():

var singleClient = new LINQ(clients).Where(function(client) { return (client.username == username); }).Select(function(client) {return client;}).Single();


It is very fast and simple, if you use linq on c#, you are no problem to use it.

For some question you can contact me, i respond to you.