【问题标题】:I have input of type datetime-local in html ,l should line to binding default valeu with angular我在 html 中有 datetime-local 类型的输入,我应该将默认值与 angular 绑定
【发布时间】:2021-04-10 21:43:13
【问题描述】:
我在 html 中有一个 date-local 类型的输入,我有一个默认值的变量,我想绑定到输入值。
像这样:
Const today=momento.format("yyy-mm-dd")
HTML:
< input type="date-local" valeu="{{today}}"/>
但不工作!!
【问题讨论】:
标签:
javascript
html
angular
【解决方案1】:
I was look for the solution and i found this:
import {toDate,format} from 'date-fns-tz'
const event = new Date();
const parisDate = toDate(event.toISOString())
const pattern = "yyyy-MM-dd'T'HH:mm"
const timeOutput = format(parisDate,pattern, { timeZone: 'UTC/GMT+1' })
this.datatime=timeOutput.slice(0, 16);