Datetime value



  • I have been trying to use the q-datetime component, and it looks nice and all, but I really wonder why the input output value is not a plain old JS Date class and not a moment formattet ISO string.

    JS has many strange features :-), but the date class is very handy, and it feels natural to use for exchanging date related data.



  • I would guess it is because Moment also takes care of formatting for locales (i18n), which is also built into Quasar.

    http://quasar-framework.org/guide/app-troubleshoot-and-tips.html#Configuring-Momentjs-Localization

    Scott



  • This is a sensible thing not to reinvent date formatting, but as datetime transportation type the build in Date class has all that is needed, and when using Typescript it makes even more sense than using a string that need a certain ISO format.

    Could we are leased make q-datetime accept both as value ?


  • Admin

    We will. I’d even be happy to drop the Momentjs dependency altogether. There’s a lot of work to be done for this as Momentjs is not used only for formatting a date.



  • It may be a good idea to make formatting optional, but this is more and less becoming the JS default way of handling data formatting, so one may be using it somewhere else.

    q-datetime could have an optional format function, to delegate this to the user of the component, and eliminate the use of moment if not strictly needed. But is is nice that you are thinking about this, to slim down the code.

    But using pure dates for all value in date time relation, would be really nice.


Log in to reply
 

Looks like your connection to Quasar Framework was lost, please wait while we try to reconnect.