locked
DatePicker: date, month and year pattern

    Question

  • Any clues on where I can get info about this  new properties? The docs don't say much about it nor do they show any info. There's a sample, but it does not use any of these new properties.

    btw, how do these properties integrate with the new calendar property? 

    thanks.


    Luis Abreu

    Friday, March 02, 2012 9:22 PM

Answers

  • Hi,

    You can change the pattern of the day, month, or year. By default, the DatePicker displays the full name of the month, a 2-digit day, and a 4-digit year in the en-us locale. You can change this by means of modifying corresponding patterns.

    The following list gives the possible values for the patterns you can use in a DatePicker:

    • {day.integer} | day.integer(n)}
    • {dayofweek.full} | {dayofweek.abbreviated} | {dayofweek.abbreviated(n)}
    • {dayofweek.solo.full} | {dayofweek.solo.abbreviated} | {dayofweek.solo.abbreviated(n)}
    • {month.full} | {month.abbreviated} | {month.abbreviated(n)}
    • {month.solo.full} | {month.solo.abbreviated} | {month.solo.abbreviated(n)}
    • {month.integer} | {month.integer(n)}
    • {year.full} | {year.full(n)} | {year.abbreviated} | {year.abbreviated(n)}
    • {era.abbreviated} | {era.abbreviated(n)}

    Please refer to the section "4. Changing the day, month, or year pattern" in http://msdn.microsoft.com/en-us/library/windows/apps/hh465480.aspx for more details.


    Best wishes,


    Robin [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 05, 2012 3:49 AM
    Moderator
  • Hi Luis,

    the calendar property is a value that maps to the Windows.Globalization calendar identifiers:http://msdn.microsoft.com/en-us/library/windows/apps/windows.globalization.calendaridentifiers.aspx, e.g. datePicker.calendar = "GregorianCalendar";

    Monday, March 05, 2012 10:35 PM

All replies

  • Hi,

    You can change the pattern of the day, month, or year. By default, the DatePicker displays the full name of the month, a 2-digit day, and a 4-digit year in the en-us locale. You can change this by means of modifying corresponding patterns.

    The following list gives the possible values for the patterns you can use in a DatePicker:

    • {day.integer} | day.integer(n)}
    • {dayofweek.full} | {dayofweek.abbreviated} | {dayofweek.abbreviated(n)}
    • {dayofweek.solo.full} | {dayofweek.solo.abbreviated} | {dayofweek.solo.abbreviated(n)}
    • {month.full} | {month.abbreviated} | {month.abbreviated(n)}
    • {month.solo.full} | {month.solo.abbreviated} | {month.solo.abbreviated(n)}
    • {month.integer} | {month.integer(n)}
    • {year.full} | {year.full(n)} | {year.abbreviated} | {year.abbreviated(n)}
    • {era.abbreviated} | {era.abbreviated(n)}

    Please refer to the section "4. Changing the day, month, or year pattern" in http://msdn.microsoft.com/en-us/library/windows/apps/hh465480.aspx for more details.


    Best wishes,


    Robin [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 05, 2012 3:49 AM
    Moderator
  • Thanks Robin.

    That's really what I'm looking for.


    Luis Abreu

    Monday, March 05, 2012 9:50 AM
  • Robin, one more thing: what about the calendar? Shouldn't I be able to write something like this to change the default calendar:

     WinJS.UI.processAll()

                    .then(function () {
                        _datePicker = document.getElementById("data").winControl;
                        var calendarPt = new Windows.Globalization.Calendar(["pt-PT"]);
                        _datePicker.calendar = calendarPt;
                    });

    Trying to run it results in an exception when i set the calendar property.

    thanks


    Luis Abreu

    Monday, March 05, 2012 11:57 AM
  • Hi Luis,

    the calendar property is a value that maps to the Windows.Globalization calendar identifiers:http://msdn.microsoft.com/en-us/library/windows/apps/windows.globalization.calendaridentifiers.aspx, e.g. datePicker.calendar = "GregorianCalendar";

    Monday, March 05, 2012 10:35 PM
  • Thanks Simon.

    Any chance of getting an update on the docs? I'm following the HTML+CSS+JS path, and it's not really obvious what one can pass to that property. For instance, the docs on that property (http://msdn.microsoft.com/en-us/library/windows/apps/hh700582.aspx) say: "Gets or sets the calendar to use." and have no reference to which type of object I'm expected to pass ...


    Luis Abreu

    Monday, March 05, 2012 10:52 PM