bootstrap-4 - 如何更改 b-input 日期类型格式?
问题描述
我正在使用bootstrap-vue b-input
with type='date'
,默认日期格式显示 dd/MM/yyyy。如何将其更改为 dd-MM-yyyy?
<b-form-group :invalid-feedback="errors.first('birth_date')"
:state="!errors.has('birth_date')"
class="col-sm-4"
label="Birth Date"
label-for="new-employer-owner-birth-date">
<b-input :state="!errors.has('birth_date')"
id="new-employer-owner-birth-date"
name="birth_date"
type="date"
v-model="newOwner.birth_date"
v-validate.disable="validation.birth_date">
</b-input>
</b-form-group>
我在属性:formatter="formatDate
之后添加了“,'type'
但它也不起作用。
解决方案
newOwner.birth_date 的格式应为 YYYY-MM-DD
如果你使用 moment(),你可以像这样格式化你的日期
const unformattedDate = yourDate;
newOwner.birth_date = moment(unformattedDate).format("YYYY-MM-DD");
推荐阅读
- sql - SQL Code = -420 在函数“decfloat”的字符串参数中发现无效字符
- java - Spring HATEOAS 构建指向分页资源的链接
- google-app-maker - AppMaker 中的过滤器
- php - PHP表单不向数据库发送数据
- javascript - RxJS.Observable 是一个单子吗?
- javascript - 在移动模式下单击按钮时,按钮仅工作一次
- reactjs - 反应路由器 v4。重定向不起作用
- c# - 在 WebDav 中打开 xlsx 文档提示重命名
- sql - 在 SQL 中计算百分位数
- laravel - laravel 应用程序不会出现在本地主机上