日期选择器格式化小时

时间:2019-06-21 08:22:31

标签: angular datepicker angular-material

我已经在day incorrect in angular material datepicker处实现了时间格式的解决方案。因为当前,当我选择一个日期时,它会花2小时,然后它将前一天的日期发送给我。

但是当我选择一个日期时,出现以下错误:

  

MyFile.html:6错误TypeError:format.replace不是函数

     

at expandFormat(moment.js:628)
  在configFromStringAndFormat(moment.js:2424)           在prepareConfig(moment.js:2592)           在createFromConfig(moment.js:2561)           在createLocalOrUTC(moment.js:2648)           在createLocal(moment.js:2652)           在钩子上(moment.js:12)           在MomentUtcDateAdapter.push ../ node_modules/@angular/material-moment-adapter/esm5/material-moment-adapter.es5.js.MomentDateAdapter._createMoment(material-moment-adapter.es5.js:424)中           在MomentUtcDateAdapter.push ../ node_modules/@angular/material-moment-adapter/esm5/material-moment-adapter.es5.js.MomentDateAdapter.parse(material-moment-adapter.es5.js:264)           在MatDatepickerInput.push ../ node_modules/@angular/material/esm5/datepicker.es5.js.MatDatepickerInput._onInput(datepicker.es5.js:3192)       View_Myfileomponent_0 @ MyFileComponent.html:6       proxyClass @ Compiler.js:17945       push ../ node_modules/@angular/core/fesm5/core.js.DebugContext_.logError @ core.js:22729       push ../ node_modules/@angular/core/fesm5/core.js.ErrorHandler.handleError @ core.js:14645       dispatchEvent @ core.js:19126       (匿名)@ core.js:19569       (匿名)@ platform-b​​rowser.js:993       push ../ node_modules / zone.js / dist / zone.js.ZoneDelegate.invokeTask @ zone.js:421       onInvokeTask @ core.js:16147       push ../ node_modules / zone.js / dist / zone.js.ZoneDelegate.invokeTask @ zone.js:420       push ../ node_modules / zone.js / dist / zone.js.Zone.runTask @ zone.js:188       push ../ node_modules / zone.js / dist / zone.js.ZoneTask.invokeTask @ zone.js:496       invokeTask @ zone.js:1540       globalZoneAwareCallback @ zone.js:1566       MyfileComponent.html:6错误上下文DebugContext_ {view:{…},nodeIndex:22,nodeDef:{…},elDef:{…},elView:{…}}

0 个答案:

没有答案