uni-app time picker only shows year and month

year month day code

<picker class="text" mode="date"  :value="monthTime" start="2021-01" end="2050-09"
    @change="DateChange">
        <view class="picker">
            {{monthTime}}
        </view>
        <image class="img" src="../static/wallet/top.png" mode=""></image>
    </picker>

Display year month day effect

year month code

<picker class="text" mode="date" fields="month" :value="monthTime" start="2021-01" end="2050-09"
    @change="DateChange">
        <view class="picker">
            {{monthTime}}
        </view>
        <image class="img" src="../static/wallet/top.png" mode=""></image>
    </picker>

Only show the effect of year and month

Show year code only

<picker class="text" mode="date" fields="year" :value="monthTime" start="2021-01" end="2050-09"
@change="DateChange">
        <view class="picker">
            {{monthTime}}
        </view>
        <image class="img" src="../static/wallet/top.png" mode=""></image>
    </picker>

Only show year effect

To display the year and month, just add: fields=”month”

To display the year just add: fields=”year”

Leave a Comment

Your email address will not be published. Required fields are marked *