Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set properties of undefined (setting 'preciseDiff') #38

Open
fh32000 opened this issue Dec 1, 2022 · 3 comments
Open

Cannot set properties of undefined (setting 'preciseDiff') #38

fh32000 opened this issue Dec 1, 2022 · 3 comments

Comments

@fh32000
Copy link

fh32000 commented Dec 1, 2022

    "moment": "^2.29.4",
    "moment-precise-range-plugin": "^1.3.0",
     "vue": "^3.2.36",

import * as moment from 'moment';
import 'moment-precise-range-plugin';

var days = moment("2014-01-01 12:00:00").preciseDiff("2015-03-04 16:05:06")

@fh32000
Copy link
Author

fh32000 commented Dec 1, 2022

@codebox @chrisj-skinner

@codebox
Copy link
Owner

codebox commented Dec 1, 2022

I'm not able to reproduce this problem, if you can post some runnable code and include details of the node.js version you are using I can investigate further

@coffebar
Copy link

I'm using Vite to build front-end and had the same problem.
Workaround is to copy and modify plugin file:
change closure to named function momentPreciseRangePlugin and add line:

export default momentPreciseRangePlugin;

And were you're using momentum with plugin it should be:

import moment from "moment";
import momentPreciseRangePlugin from "./components/moment-precise-range";
momentPreciseRangePlugin(moment);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants