typescript - How to change TimePicker in NativeScript to show the time in 24-hour format? -


in nativescript, there timepicker, 1 shows time, in 12-hour format. have problem, because in database of times saved in string (in format "23:59").

i canot set hour, e.g. 14.

i have idea, convert string split(':') , changing period pm, cannot see usefull method that. please, help.

you can use native apis set 24-hour format. timepicker in nativescript using uidatepicker in ios , android.widget.timepicker in android

page.js

   "use strict";     var application = require("application");     function onloaded(args) {         var page = args.object;         var tpicker = page.getviewbyid("tpicker");         if (application.android) {             tpicker.android.setis24hourview(java.lang.boolean.true);             tpicker.hour = 23;             tpicker.minute = 59;         }         else if (application.ios) {             // bit hacky solution             // important set country not language locale             var local = nslocale.alloc().initwithlocaleidentifier("nl");             tpicker.ios.locale = local;             tpicker.hour = 23;             tpicker.minute = 59;         }     }     exports.onloaded = onloaded; 

page.xml

<timepicker id="tpicker"></timepicker> 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -