lowcoder
lowcoder copied to clipboard
[Feat]:Day.js all plugins out of the box
Hello, I noticed that day.js doesn't support the iso week of the year out of the box It's impossible for me to migrare to newer version until i can add the isoWeek in the format component.
Since day.js has replaced moment, I think it would be great if all of moment's features were included in day.js
If it's not possible to include all the plugins: I would like to be able to add the plugins for all my app in Lowcoder
We found, that you can do this already. Please use the possibility per App or per Workspace to add JavaScript Libraries.
The plugins are available via https://cdn.jsdelivr.net - and so we can import them dynamically. If this for any reason not work, please re-open the issue.
I'm sorry but I was not able to make it work :( Can you help me?
The standard functions of DayJS are available. However, what you seek are eventually the advanced-format functions. We need to look at how this could work. https://day.js.org/docs/en/plugin/advanced-format
https://cdnjs.com/libraries/dayjs
Can't find it anywhere on how to add the plugin to dayjs. Can you show me?
We need kindly to excuse that this took us sooo long. Solution is: You import the JS for any DayJS Plugin you need via CDN: https://cdnjs.com/libraries/dayjs
Then in the "Scripts and Styles" for Workspace or App, you need to initialize it. For Advanced Formats for example:
var advancedFormat = require('dayjs/plugin/advancedFormat'); window.dayjs.extend(advancedFormat);
And after that, you can simply use it.
Thank you for that. I'm trying to add a timezone plugin but failed. What did I do wrong?
We need to research further. DayJs Timezone depends on UTC, which needs to be in place before. However, even with that - we did not make it running till now. DayJs Format however, works fine.
We reopen the ticket and research further
Still doesn't works for me, After copying and pasting your code and restarting the docker i get an error in the debug console: "Can't find variable require" Any clues?
We solved this in v2.3.1. Now all Day.js plugins are automatically available.