Git Product home page Git Product logo

Comments (3)

ratiw avatar ratiw commented on September 7, 2024

It looks more like you're having a problem with formatting, not really filtering. Try moment's documentation first.

from vue-table.

amitavadeb avatar amitavadeb commented on September 7, 2024

the code which i have posted is having format mis-match but no matter what i do; even if i correct the format, the filter doesnt work.

what i found is: the example of vue-table posts dates as JS object which is different from what i am getting from my server and if i make my dates as JS objects, i am unable to format it on the view front.

i am stuck here. any example? i want to create my view as "Aug 13, 2018" and want to filter dates between 2 ranges using vue-tables bootstrap-datepicker.

thanks

from vue-table.

ratiw avatar ratiw commented on September 7, 2024

@amitavadeb I'm still not quite clear about your problem, especially the filter one. I'm not sure if I will be able to answer you correctly or not. But if your server stores data in the YYYY-MM-DD format (usually called ISO format), you will have to query it using that format. On the front end, if you want to display it differently, you will first have to convert it to a generic format first, and then re-format it the way you want to display it.

If the date format sent from the server is '2011-01-12', you can tell moment to parse it correctly into its generic format like so,

  var dt = moment('2011-01-12', 'YYYY-MM-DD')

Then, you can tell moment to format it into different format like so,

  dt.format('MMMM Do YYYY')   // January 12th 2011

When you want to send the date back for your server side to process, you have to use the date format that your server understand (in this example, YYYY-MM-DD). I hope that make sense.

from vue-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.