GithubHelp home page GithubHelp logo

Comments (10)

bbennett36 avatar bbennett36 commented on May 20, 2024 1

from vue-good-table.

xaksis avatar xaksis commented on May 20, 2024

Don't sell yourself short friend! You would have done a fine job i'm sure. I used moment to parse/format dates. you can find the changes in version 1.4.0.

from vue-good-table.

xaksis avatar xaksis commented on May 20, 2024

Example usage:
you can add a column like so:

{
          label: 'Created On',
          field: 'createdAt',
          type: 'date',
          inputFormat: 'YYYYMMDD',
          outputFormat: 'MMM Do YY',
          filterable: false,
        },

and your date should look like '20160423' //depending on the format you specify in inputFormat.

from vue-good-table.

bbennett36 avatar bbennett36 commented on May 20, 2024

Awesome! Thanks, I appreciate it!

from vue-good-table.

xaksis avatar xaksis commented on May 20, 2024

No problem! let me know if you have a problem using it.

from vue-good-table.

bbennett36 avatar bbennett36 commented on May 20, 2024

I got that working but it looked like there was an error in your sort method.

I had to change

  if (this.columns[this.sortColumn].field === 'date') {
                x = moment(x + '', this.columns[this.sortColumn].inputFormat);
              }

to

  if (this.columns[this.sortColumn].type === 'date') {
                x = moment(x + '', this.columns[this.sortColumn].inputFormat);
              }

Looks like you have it looking at the field name instead of the field type. My field name was "due_date" so it wasn't working at first and I had to go through and change that.

Other than that, it works great. Thanks again!

from vue-good-table.

xaksis avatar xaksis commented on May 20, 2024

whoops! good catch... 1 fix coming right up.

from vue-good-table.

xaksis avatar xaksis commented on May 20, 2024

v1.4.1

from vue-good-table.

xaksis avatar xaksis commented on May 20, 2024

@bbennett36 I just switched out the date parsing/formatting library. Please let me know if all your use cases still work fine? Thank you!

from vue-good-table.

bbennett36 avatar bbennett36 commented on May 20, 2024

Are you able to use the 'defaultsortby' setting on a date field? Mine doesn''t seem to be working. The regular date sorting is still working perfect though.

from vue-good-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.