Giter Site home page Giter Site logo

vue-date-fns's Issues

TypeError: formatDate is not a function

Hi,
In my main.js I used to have (with version 1):

import {createDateFilter} from "vue-date-fns";
import locale from "date-fns/locale/nb";
...
Vue.filter("fullDateTime", createDateFilter("DD.MM.YYYY HH:mm:ss", {locale}));

After updating to version 2.0.0 of vue-date-fns I updated the format to:

Vue.filter("fullDateTime", createDateFilter("dd.MM.yyyy HH:mm:ss", {locale}));

Now I keep getting in console:
"vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in render: "TypeError: formatDate is not a function""

with a reference to the index.js of the vue-date-fns package:

var formatDate = require("date-fns/format"); 

// https://date-fns.org/v2.14.0/docs/format#v2.0.0-breaking-changes
var DEFAULT_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSxxx";

function createDateFilter (defaultFormat, defaultOptions) {
  return function dateFilter (date, format, opts) {
    if (!date) {
      return "";
    }
    return formatDate(date, format || defaultFormat || DEFAULT_DATE_FORMAT, Object.assign({}, defaultOptions || {}, opts));
  };
}

Any suggestions what I might be doing wrong?

Any plans to upgrade to date-fns-2 ?

It's been a while since it came out. I'm not even sure if upgrading has any significant gains but I just wanna know your plans for this wrapper

Error: 'default' is not exported by node_modules\vue-date-fns\src\index.js

This statement no longer works? import dateFilter from 'vue-date-fns';

I am getting this error: Error: 'default' is not exported by node_modules\vue-date-fns\src\index.js imported by <snip>...

This is what is in my package.json :

    "date-fns": "^2.21.3",
    "vue": "^2.6.11",
    "vue-class-component": "^7.2.3",
    "vue-date-fns": "^2.0.1",

Any thought?

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.