Skip to content

Instantly share code, notes, and snippets.

@cristhian-net
Created May 11, 2017 12:41
Show Gist options
  • Save cristhian-net/c7bc4d5d02c818e8f08f961694a6db09 to your computer and use it in GitHub Desktop.
Save cristhian-net/c7bc4d5d02c818e8f08f961694a6db09 to your computer and use it in GitHub Desktop.
import * as moment from 'moment';
export class FechaValueConverter {
public toView(value, format) {
if(value){
format = format || 'DD/MM/YYYY hh:mm A';
return moment(value).format(format);
}
}
public fromView(value, format) { // 'DD/MM/YYYY hh:mm A'
if(value){
format = format || 'DD/MM/YYYY hh:mm A';
return moment(value, format).toDate();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment