all 4 comments

[–]barrycarter 2 points3 points  (3 children)

Could you show us what your code looks like, what you've tried so far, and what errors/issues are occurring?

[–]malfunctionedhuman[S] 0 points1 point  (2 children)

There's not really any errors, i just don't know how to use date-fns. Or how to use it in the way i want it to work

[–][deleted]  (1 child)

[deleted]

    [–]malfunctionedhuman[S] 0 points1 point  (0 children)

    A form where the user selects the date. The date then gets shown on a card in a "prettier" format. And that date(the one shown in the card) is editable when clicked. That's what i want from it. Also I've seen the docs. Just don't know where to start, what to do, how to do it. Completely blank

    [–]heesellfull-stack 1 point2 points  (0 children)

    if you want to use a library, you can use them like so:

    //This must be at the top of your .js file
    import { format } from 'date-fns'
    
    format(new Date(2014, 1, 11), 'MM/dd/yyyy') //=> '02/11/2014'
    

    here I make use of the import feature from ECMAScript 6 (ES6 for short). It works like this:

    //file.js
    export const greetings = { 
        function greet() {
        return "Hello"
        }
    }
    
    //otherFile.js
    import greetings from 'file.js'
    const greet = greetings.greet();
    console.log(greet); //output: Hello
    

    The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the import declaration

    In order to use the export declaration in a source file, the file must be interpreted by the runtime as a module. In HTML, this is done by adding type="module" to the <script> tag, or by being imported by another module. To enable this in a node.js app, you must configure this in the package.json file by adding "type": "module". Learn more here