Search Unity

[RELEASED] DatePicker for UnityUI

Discussion in 'Assets and Asset Store' started by DaceZA, Aug 11, 2016.

  1. DaceZA

    DaceZA

    Joined:
    Dec 19, 2014
    Posts:
    174
    DatePicker is a powerful control for date selection using the UnityUI.

    DatePicker v1.00 is currently available on the Asset Store, and v1.01 has been submitted and should be available in the next few days!

    Web GL Demo
    Documentation


    Features:
    * Use inline or popup DatePicker controls
    * Select either a single date, or a date range
    * Highly customizeable appearance and functionality
    * Automated localization using .NETs current culture
    * Fully compatible with XmlLayout

    Includes TableLayout!


    Please feel free to post any questions, suggestions, or comments here!
     
  2. blevok

    blevok

    Joined:
    Feb 16, 2017
    Posts:
    75
    Hi, i sent an email to your support address a week ago, but haven't received a response. Maybe it went to spam or something? Anyway, i bought Date Picker for a unity android project, but i'm having an issue with the input box reverting to default after the text property is changed in code.

    Here's my situation. I have a prefab which includes a popup date picker, among other things. I instantiate one prefab for each row in a database table. After each prefab is instantiated, i change the date picker input field text to the existing date string from the database table row.

    Here is how i'm filling the input field. ItemRow is the instantiated prefab.
    Code (CSharp):
    1. ItemRow.transform.Find("ItemEditPanel/ItemEditDatePicker/Input Field Container/Row/Cell/ItemEditDatePickerInputField").GetComponent<InputField>().text = item.ItemDate;
    When i run the program and generate the list of prefabs, the date from the database fills the input field, but after a split second, the input field then resets to the placeholder text that i set in the editor.

    I read this in the user guide pdf:
    "DatePicker will automatically update whenever any changes are made to any of its properties."

    So does that mean i am causing it to update to it's default state by changing one of it's properties (changing the input box text from code)?

    I have other input fields in the same prefab that don't have this resetting issue, so it seems like it's specifically related to the update mentioned in the user guide. How can i make it so that the input field only changes when a date is selected, or when it is changed in code (ie. when it is deliberately changed)?

    Thanks in advance for any assistance.
     
  3. DaceZA

    DaceZA

    Joined:
    Dec 19, 2014
    Posts:
    174
    Hi Blevok,

    Sorry for the delay in responding - I don't seem to have received your e-mail in my support address (I've just checked the spam folder as well and it wasn't there - did you send it to support@digital-legacy.co.za?)

    With regards to your question:

    The text value in the input field is strictly controlled by DatePicker, as such any changes to it directly will be lost whenever DatePicker deems it necessary (which may be for any number of reasons, including initialization, date value changes, etc.). Rather than setting the text of the input field, you should rather be setting the date value of the DatePicker itself - DatePicker will then set the text for you, for example:

    Code (CSharp):
    1. ItemRow.transform.Find("ItemEditPanel/ItemEditDatePicker").GetComponent<UI.Dates.DatePicker>().SelectedDate = item.ItemDate;
    If ItemDate is a string rather than a .NET DateTime object, then you'll need to parse it, e.g.

    Code (CSharp):
    1. ItemRow.transform.Find("ItemEditPanel/ItemEditDatePicker").GetComponent<UI.Dates.DatePicker>().SelectedDate = DateTime.Parse(item.ItemDate);
    I hope this helps!
     
  4. blevok

    blevok

    Joined:
    Feb 16, 2017
    Posts:
    75
    Awesome, i just tried it like that and it works perfectly. Thank you.

    As for the email, i checked again and i did send to that exact address. On my end it seems to have been sent without issue. If you care to investigate further on your end, the email was sent on May 18, 2019, 1:32 PM CST(UTC -06:00). The subject line is "date picker issue", and it was sent from a gmail address that starts with "blevok".

    Thanks again!
     
  5. DaceZA

    DaceZA

    Joined:
    Dec 19, 2014
    Posts:
    174
    You're welcome, I'm glad I was able to help.

    Just double-checked my e-mail client and nothing is there - I'm not sure why your e-mail didn't come through. Oh well, at least you were able to contact me here :)
     
  6. UnusAutomationSystems

    UnusAutomationSystems

    Joined:
    Jul 15, 2019
    Posts:
    49
    Hello

    this calendar asset is for mobile platform as well? or just for desktop?
     
  7. DaceZA

    DaceZA

    Joined:
    Dec 19, 2014
    Posts:
    174
    Hi there,

    DatePicker works on most platforms, including Android and iOS :)
     
  8. micheal332001

    micheal332001

    Joined:
    Mar 18, 2017
    Posts:
    27
    i have a problem with the datepicker i have had to resize the input to fit my needs.
    i also have multiple datepickers as i need these
    the date on these shows current month but when changing to the following month it goes blank
     

    Attached Files:

  9. micheal332001

    micheal332001

    Joined:
    Mar 18, 2017
    Posts:
    27
    have not had a reply to emails or to this post or to a review i posted about the problem
    where is the support for this product
     
  10. DaceZA

    DaceZA

    Joined:
    Dec 19, 2014
    Posts:
    174
    Hi Micheal,

    Sorry for the delay, I was ill. However, I see that you sent me an e-mail as well, which I responded to yesterday. Did you not receive my response?
     
  11. micheal332001

    micheal332001

    Joined:
    Mar 18, 2017
    Posts:
    27
    Sorry no but found it in my spam folder.

    I will try what you have suggested and let you know the outcome.

    Many thanks for getting back to me.
     
  12. micheal332001

    micheal332001

    Joined:
    Mar 18, 2017
    Posts:
    27
    thank you again for sorting this problem out for me.
    makes my job a lot easier for the dates to the app im making.

    Many thanks and great support.
     
    DaceZA likes this.
  13. blevok

    blevok

    Joined:
    Feb 16, 2017
    Posts:
    75
    Hi, i have another question about the date picker.

    If i open the date picker, and move to a different month, and then close the date picker without selecting a date, and then open it again, the visible month doesn't reset to the current month.

    I tried resetting it like this, but it doesn't work.
    Code (CSharp):
    1. ItemDatePicker.GetComponent<DatePicker>().VisibleDate = DateTime.Today;
    I noticed that when i click the "X" button next to visible date in the inspector, it does exactly what i want to do.



    How can i accomplish the same thing that the inspector button does from my code?
    Thanks