在Jquery Ui日历中显示年份值年份值

时间:2017-04-19 08:32:09

标签: jquery jquery-ui ui-calendar

我使用以下代码来显示日历

$( "#datepicker" ).datepicker({
        numberOfMonths: 2,
         selectMultiple: true,
         monthNames: [ "1月","2月","3月","4月","5月","6月",
                         "7月","8月","9月","10月","11月","12月" ],
        dayNamesMin: ['日','月','火','水','木','金','土'],
        showMonthAfterYear: true, //this is what you are looking for

        beforeShowDay: highlightDays,
        onSelect: function(selectedDate) {
            date = jQuery(this).datepicker("getDate");
            var rs = date.getDate();                               
        }
        });

当前输出enter image description here

我想在年后添加年份符号,如下所示

enter image description here

1 个答案:

答案 0 :(得分:0)

我使用以下代码获得了此信息。

class ParkSerializer(serializers.ModelSerializer):
    location = serializers.CharField(source='alternate_name')

    class Meta:
        model = Park
        fields = ('id', 'name', 'location')