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();
}