Ant-design-vue: 如果判断变量是moment 的格式 / (date-picker)

Created on 28 Mar 2020  ·  5Comments  ·  Source: vueComponent/ant-design-vue

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.5.0-rc.6

Environment

macos, chrome 78, vue 2.6.10

Reproduction link

Edit on CodeSandbox

Steps to reproduce

codesandbox

What is expected?

通过一个方法、一个属性,能够友好的、优雅的判断这个变量是moment Object。

我们项目使用date-picker 组件是比较频繁的,我们有一些需求,动态的去判断这个变量是不是moment。

What is actually happening?

不友好、不优雅的判断。


感谢所有人!

Most helpful comment

All 5 comments

这是我现在处理的代码截图,看起来很不友好。

1585295431193

非常感谢 🙏

https://momentjs.com/docs/#/query/is-a-moment/

不好意思,再打扰下;

你知道如何判断这个moment 是日期(YYYY-MM-DD)还是日期时间(YYYY-MM-DD HH:mm:ss)么?

我看了下moment 的文档,好像没有讲到这块。

Was this page helpful?
0 / 5 - 0 ratings