Setting initial value of TimePicker

9 posts, 0 answers
  1. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 01 Aug Link to this post

    Hi Guys

    This stupid little issue is taking up way way too much time for me to resolve..

    I am setting a timepicker as follows:

      <td class="tg-7uzy">

                    @Code
                        With Html.Kendo().TimePicker()
                            .Name("1Open")
                            .Events(Function(events) events.Change("settime"))
                            .Value(New TimeSpan(0, Model.Hours(1).open, 0))
                            .Min(New TimeSpan(0, 0, 0))
                            .Max(New TimeSpan(0, 0, 0))
                            .Render()
                        End With
                    End Code
                </td>

    The result is as per the attached screen shot.

    It 'looks like' the values are set right as the timepickers have the correct times , but when you drop down, it always starts at midnight and the current time is not highlighted.  I assume the timepicker needs the value to be set with AM or PM .. but that can't be done from a TimeSpan or a datetime.. the am pm always has dots ( a.m.  , p.m.)

     

    If tried adding .Format("HH:mm:tt") and  .ParseFormats(New String() {"HH:mm:tt"}) etc, but I just can't get it to work. ( I've tried allot more formats than just these, I've tried "HH:mm tt" ,"HH:mm t.t." ( cause it's the dots around the am pm which seems to be whats stopping.))

    Feeling a bit stupid having to ask this as it seems to be a straightforward thing.

    I'm sure I will have a Face palm moment when shown the error in my ways.. but I've got to the point of not caring! :)

    Cheers

    Rob

     

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 03 Aug Link to this post

    HelloRob,

    I tried to replicate the behavior, however, I was not able to. Check out the online example where the initial time is selected when you open the dropdown.

    http://demos.telerik.com/aspnet-mvc/timepicker/index


    Please let me know what needs to be different in order to replicate the behavior you are observing.


    Regards,

    Viktor Tachev
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 03 Aug in reply to Viktor Tachev Link to this post

    You reference is setting a timepicker from a string.. I don't want to store times as strings.

    I note from the docs that this method is a TimeSpan

    Methods
    Value(System.Nullable<System.TimeSpan>)

    Sets the value of the timepicker input 

     

    I am storing the times as 'minutes since midnight'

    Hence I have setting 

    .Value(New TimeSpan(0,600, 0))

    compared to the example you linked to which is

    .Value("10:00 AM")

    Thanks

    Rob

     

  5. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 05 Aug Link to this post

    Hi Rob,

    Please make sure that you are using the latest version of the components. The current release is 2016.2.714. Upgrade KendoUI and the time should be focused as expected.

    I made a sample video of the behavior I am seeing on my end with the latest release. Check it out here.

    Regards,
    Viktor Tachev
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 06 Aug in reply to Viktor Tachev Link to this post

    Thanks

    So at least I know it should work how I am trying! :)

    I have( already had) the very latest everything here and not the same results.

    To test;

    I just created a new Telerik  ASP.NET MVC Application. ( screen shot attached)

    Added the same code as you in the index screen 

    (Screen shot attached)

    Hit run and it doesn't work. :(

     

    Maybe this is a regional / Time display issue / Bug? 

    Thanks

     

    Rob

  7. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 06 Aug in reply to Rob Link to this post

    Sorry , some of those pictures got screwed up somehow.. attach some new ones. 

    I considered adding the new project, but it is literally a new Telerik ASP project template with the single div added.. seems pointless!

    Thanks

     

    Rob

  8. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 07 Aug in reply to Rob Link to this post

    I can confirm this is a Regional /time format issue.

    If I change my system to to UK time formats ( and others)  it works.

    It seems that the standard NZ time format with the lower case am pm with the dot's is causing the issue.  ( Not sure what other regions are affected)

    I can't have a solution that only works in some regions obviously.

    Can you suggest any nice ways of handling this?

    Thanks

    Rob

     

     

     

  9. Rob
    Rob avatar
    59 posts
    Member since:
    Jan 2012

    Posted 07 Aug in reply to Rob Link to this post

    I wish I could edit rather than more posts..lol

    FYI: I have carried on with this project and the Timepickers are now 'fors'

    @Code
                     With Html.Kendo().TimePickerFor(Function(f) f.sun_open)
                         .Name("0Open")
                         .Events(Function(events) events.Change("settime"))
                         .Min(New TimeSpan(0, 0, 0))
                         .Max(New TimeSpan(0, 0, 0))
                         .Render()
                     End With
                 End Code

    Changed the Model to be timespan obviously.

    When displayed , the time picker is showing the correct time in the NZ time format , but once again it is not actually setting the value of the time picker. :(

     

    Regards

    Rob

  10. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 09 Aug Link to this post

    Hi Rob,

    In this case it will be best to open a official support ticket and send us isolated runnable version of your applictaion that demonstrates the problem. Thus we will be able to replicate the issue locally and advise you further.

    Regards,
    Maria Ilieva
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET MVC is VS 2017 Ready