I just installed this plugin by the command tns plugin add nativescript-modal-datetimepicker and use it in my Angular NS.

main.component.ts:

import * as ModalPicker from ‘nativescript-modal-datetimepicker’;

pickDate() {
const picker = new ModalPicker.ModalDatetimepicker();
picker.pickDate({
title: ‘Please enter your birthday’,
theme: ‘dark’,
maxDate: new Date(),
is24HourView: false
}).then((result) => {
this.birthday = result[‘year’] + ‘-‘ + result[‘month’] + ‘-‘ + result[‘day’];
}).catch((error) => {
console.log(‘Error: ‘ + error);
});
}
main.component.html:

 

By admin

Leave a Reply

Your email address will not be published. Required fields are marked *