Skip to main content
Became Hot Network Question
added 2 characters in body
Source Link
S.B.
  • 2.1k
  • 3
  • 29
  • 66

I am trying to use Luxon in ana LWC.

I believe I am messing up the syntax of the decomposition of DateTime from the library.

Following the documentation: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.js_third_party_library

My Steps

I started by downloading Luxon from GitHub: https://github.com/moment/luxon

I extracted luxon-master.zip and rezipped the /src directory.

I renamed the .zip "luxon". I uploaded this to static resources as "Luxon".

My Import:

import DateTime from '@salesforce/resourceUrl/Luxon';
import {loadScript} from 'lightning/platformResourceLoader';

renderedCallback()

renderedCallback() {
    loadScript(this, LuxonDateTime + '/luxon.js')
.then(() => { /* callback */ });
}

Use Luxon DateTime

get luxonDate() {
    return DateTime.now().toISO();
}

I am trying to use Luxon in an LWC.

I believe I am messing up the syntax of the decomposition of DateTime from the library.

Following the documentation: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.js_third_party_library

My Steps

I started by downloading Luxon from GitHub: https://github.com/moment/luxon

I extracted luxon-master.zip and rezipped the /src directory.

I renamed the .zip "luxon". I uploaded this to static resources as "Luxon".

My Import:

import DateTime from '@salesforce/resourceUrl/Luxon';
import {loadScript} from 'lightning/platformResourceLoader';

renderedCallback()

renderedCallback() {
    loadScript(this, Luxon + '/luxon.js')
.then(() => { /* callback */ });
}

Use Luxon DateTime

get luxonDate() {
    return DateTime.now().toISO();
}

I am trying to use Luxon in a LWC.

I believe I am messing up the syntax of the decomposition of DateTime from the library.

Following the documentation: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.js_third_party_library

My Steps

I started by downloading Luxon from GitHub: https://github.com/moment/luxon

I extracted luxon-master.zip and rezipped the /src directory.

I renamed the .zip "luxon". I uploaded this to static resources as "Luxon".

My Import:

import DateTime from '@salesforce/resourceUrl/Luxon';
import {loadScript} from 'lightning/platformResourceLoader';

renderedCallback()

renderedCallback() {
    loadScript(this, DateTime + '/luxon.js')
.then(() => { /* callback */ });
}

Use Luxon DateTime

get luxonDate() {
    return DateTime.now().toISO();
}
Source Link
S.B.
  • 2.1k
  • 3
  • 29
  • 66

Import Luxon into LWC

I am trying to use Luxon in an LWC.

I believe I am messing up the syntax of the decomposition of DateTime from the library.

Following the documentation: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.js_third_party_library

My Steps

I started by downloading Luxon from GitHub: https://github.com/moment/luxon

I extracted luxon-master.zip and rezipped the /src directory.

I renamed the .zip "luxon". I uploaded this to static resources as "Luxon".

My Import:

import DateTime from '@salesforce/resourceUrl/Luxon';
import {loadScript} from 'lightning/platformResourceLoader';

renderedCallback()

renderedCallback() {
    loadScript(this, Luxon + '/luxon.js')
.then(() => { /* callback */ });
}

Use Luxon DateTime

get luxonDate() {
    return DateTime.now().toISO();
}