【问题标题】: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);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-10
    • 2016-04-05
    • 2022-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多