-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
🎁 2.0 Milestones【Breaking Change】 #1281
Comments
I currently have some problem with In the current Day.js, while we import some plugin like isLeapYear, it will update the TS definition to add a new method checking this: https://github.com/iamkun/dayjs/blob/dev/types/plugin/isLeapYear.d.ts However, after I changing I don't know TS much and need some help, pls.✋🏼 |
Because the original type definitions use For |
I wanna point out, the recent typescript changes done in 1.10 actually broke in my project with the way that it was documented online on how to install/use dayjs in angular import * as updateLocale from 'dayjs/plugin/updateLocale'
import * as relativeTime from 'dayjs/plugin/relativeTime'
import * as LocalizedFormat from 'dayjs/plugin/localizedFormat'
import * as dayjs from 'dayjs'
dayjs.extend(LocalizedFormat)
dayjs.extend(relativeTime)
dayjs.extend(updateLocale)
dayjs.locale('is') Error: So there already has been breaking changes, especially with usage on typescript so might as well just push these changes over since people are gonna have to update their projects |
@TheThing said to hear this, however, seems in 1.10.x there's no typescript change as far as I cloud tell. |
@TheThing I have the same issue. did you fixed yours? How? I tried something like this: import dayjs, { extend } from 'dayjs' |
I just made the version in package.json hard value to the last known working version: If dayjs is gonna add breaking changes without increasing their major version, I might as well just lock the version :) |
According to 1.10.0 logs this was changed:
I jsut assumed that broke previous old typescript loading |
@TheThing This must be an unexpected change. But this still confused me, why a esm update leads to a typescript error. I'll need some time to check this out. |
lol, it was slightly annoying to find out my build was failling but what can you do :b Also I ran a few tests and you are right, the problem is weird but it might have something to do with module detection and/or babel in angular where at least I am using it. Comparing the output of this in node: import * as dayjs from 'dayjs'
console.log(dayjs) between both versions provide identical output: PS D:\NFP\nfp\kisildalur> npm install dayjs@1.10.1
PS D:\NFP\nfp\kisildalur> node test.mjs
(node:4284) ExperimentalWarning: The ESM module loader is experimental.
[Module] {
default: [Function: v] {
extend: [Function (anonymous)],
locale: [Function: D],
isDayjs: [Function: m],
unix: [Function (anonymous)],
en: { name: 'en', weekdays: [Array], months: [Array] },
Ls: { en: [Object] },
p: {}
}
}
PS D:\NFP\nfp\kisildalur> npm install dayjs@1.9.7
PS D:\NFP\nfp\kisildalur> node test.mjs
(node:14660) ExperimentalWarning: The ESM module loader is experimental.
[Module] {
default: [Function: v] {
extend: [Function (anonymous)],
locale: [Function: D],
isDayjs: [Function: m],
unix: [Function (anonymous)],
en: { name: 'en', weekdays: [Array], months: [Array] },
Ls: { en: [Object] },
p: {}
}
} However when running angular run or angular build, it will fail when import * as updateLocale from 'dayjs/plugin/updateLocale'
import * as relativeTime from 'dayjs/plugin/relativeTime'
import * as LocalizedFormat from 'dayjs/plugin/localizedFormat'
import * as dayjs from 'dayjs'
dayjs.extend(LocalizedFormat)
dayjs.extend(relativeTime)
dayjs.extend(updateLocale)
dayjs.locale('is')
so I decided to check the output of both from the angular build by doing something like this and checking the output in browser as opposed to in node like I did previously: import * as dayjs from 'dayjs'
console.log(dayjs) That's when we get a difference: |
More fun facts. This doesn't work in 1.10.1 in angular: import dayjs from 'dayjs'
However this will make it work import * as inbetweener from 'dayjs'
let stupidtypescript:any = inbetweener
const dayjs = stupidtypescript.default
dayjs.extend(LocalizedFormat)
dayjs.extend(relativeTime)
dayjs.extend(updateLocale)
dayjs.locale('is') lol @bboydflo this is how you fix that stupid error xD |
This change in 1.10.1 add ES6 Module Support, package.json module point to "esm/index.js" (#1298) (f63375d) really has an unexpected breaking change, and that's of course not what we want. I am planning to revert this change in the next release 1.10.2 and delete the "module" entry. Besides, maybe there's no need for Day.js to support ESM bundle, this would only introduce some conflict but no benefits in the tree shaking. A better way might be a separate npm package (like "dayjs-esm") to ship an ESM package. |
1.10.2 has reverted the bc, tested ok on my side |
Just released v1.10.2 to revert the esm Let leave this breaking change to v2.0.0 |
@iamkun the issue discussed here is the same I have reported at the end of November: #1242 |
@hakimio yes, that's why I listed the second thing to do is to
|
Maybe this is related to all things happening with the latest release of dayjs and using TS. I apologize if I write this within this issue and I'm happy to open a new issue if this does not belong here. Current Environmentpackage.json
tsconfig.json
index.tsx
Observed behaviorERROR: TypeError: dayjs__WEBPACK_IMPORTED_MODULE_11___default(...) is not a function As a workaround I can export namespace dayjs in *.d.ts but then I do not get all of the properties such as fromNow(), ... Is there a solution to this, or is the next release fixes this? |
I'm going to +1 here to say that unfortunately this Thanks for doing better TypeScript support and also for the dayjs package itself, @iamkun. Thanks! |
For 2.0, I think ESM should be the default. That is the way the whole world is moving. Then we could create |
Any news on this 2.0 version ? |
Hi, I'm working on a plugin in which add a property to "OptionType". like
this is the change that makes things easier. Is there a better solution? I can help with the new version <333 |
@always-maap did you find a solution to your problem? I think I'm possibly having the same one (#1605) |
yes indeed, this is the code example. https://www.github.com/zoomit-org/Dayjs-Jalali-Plugin/tree/master/index.d.ts ask me any questions you want, I'm available |
@JesusTheHun I'm refactoring There will be the following changes.
Repo: https://github.com/sxzz/dayjs/tree/next At this very early stage, some features and plugins have not been implemented. Breaking Change
|
v2.0 branch https://github.com/iamkun/dayjs/tree/next |
Could we get a |
Before opening an issue @iamkun, I was wondering about something concerning using DayJS in the context of TS. If we take a look at the docs for a functionality such as 'from now', we can see the following in the documentation:
Being new to TS and ES6 modules, it took me a good while to figure out that I had to do the following to make it work:
What would think of creating an issue with the intent of extending the documentation (fantastic work btw) to correct this? And if I'm incorrect and there are some clear indications somewhere for TS, please let me know! |
I am trying this in a React project (JS not TS) and it does not work. I get the error My code is: |
@yohanelly95 Are you using version |
nope I am using |
@yohanelly95 did you solve this issue, I'm using |
I'm on import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import updateLocale from 'dayjs/plugin/updateLocale';
dayjs.extend(relativeTime); // <-fine
dayjs.extend(updateLocale); // <-fine
// v- TS2339: Property 'updateLocale' does not exist on type 'DayjsFn'.
dayjs.updateLocale('en', {
// ... edit: Funny, when I switch to this kind of import the error shifts: import * as dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import updateLocale from 'dayjs/plugin/updateLocale';
// v-TS2339: Property 'extend' does not exist on type 'typeof import("/Users/REDACTED/node_modules/dayjs/dist/index")'.
dayjs.extend(relativeTime);
// v-TS2339: Property 'extend' does not exist on type 'typeof import("/Users/REDACTED/node_modules/dayjs/dist/index")'.
dayjs.extend(updateLocale);
dayjs.updateLocale('en', { // <-Suddenly fine
// ... edit2: Which brings us to our final working solution! import * as dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import updateLocale from 'dayjs/plugin/updateLocale';
dayjs.default.extend(relativeTime);
dayjs.default.extend(updateLocale);
dayjs.updateLocale('en', {
// ... edit3: Wasn't a solution after all, only my IDE (WebStorm) understood what I was doing but the Angular/typescript service did not agree: |
typescript 5 released |
Maybe related: it seems like there are some problems with the TS types / packaging for
|
Publint is also reporting 3 errors and 1 warning:
|
…yjs from 1.11.10 to 2.0.0-alpha.4 - see iamkun/dayjs#1281
Hey, is this milestone being pursued, or has Dayjs entered maintenance mode? There are tons of PRs. We are using Deno and this ESM issue affects our use of Dayjs. |
* fix: package-lock.json * feat: add permissions test + move start servers into index.js * fix: re-added missing functions/logic - added back things that went missing during the migration - the docker-compose logs are now saved - reordered variables, imports, ... - specify the source of $fetch calls - fixed the default 8px margin, see https://www.joshwcomeau.com/css/custom-css-reset/ for more CSS hacks - tried to fix the emits, subject to change - VJSF migration not 100% done yet - probably fixed some ws bugs - moved sources/ to ui/assets/sources/ - removed every require left - ui/assets/format.js seems unused - ui build now deletes the right folder - fixed the middleware - fixed some event bus oversights - store update: added error(), changed the login (! this can be the source of some errors) * fix: tests + bug : /api/v1/runs never return 403 error + bug : processings tests doesn't work * fix: permission reQSession -> req + add logs * fix: temporarily disabled the middleware (/admin/plugins error) * fix: test 'create a new processing' * fix: finished the migration ? - the middleware now works - fixed some migration issues - uses navigateTo instead of router.push - the error layout is now in ui/ - properly set the HEAD metadata - moved all filters in 1 file - _id.vue is now [id].vue - properly instantiate the store * fix: test config dir * Merge nuxt3 into livrables * fix: css * feat: use @df/testSpies * fix: config dir * fix: test SIGTERM kill and stop worker at the end * fix: remove hooks in worker server * chore: remove eslint config from package.json * fix: removed the middleware, better requests body, better error layout, some fixes in the store * fix: package-lock.json * feat: notification event hook -> test:spy * fix: vuetify styles are now properly applied * fix: removed @data-fair/sd-vue * feat: remove ./test * fix: eslint config - fix some eslint errors - create a gitignore for ui - better nuxt.config.js * fix: better card styles * fix: uses the compat function from VJSF * fix: ui Dockerfile * fix: mongo url in prod - When testing the API Docker image, connection to the database was not working. * fix: worker Dockerfile * fix: worker Dockerfile * fix: small UI tweaks + fixed saving the state of a plugin (public or not + define access) * feat: clean ui config * fix: the forms are displayed - fixed the vjsf usage - added the missing @koumoul/vjsf-markdown - simplified the npm run i command - when you create a processing, the create button is disabled (spam-clicking it would create a ton of them) and displays a progress bar - /admin now redirects to /admin/plugins - probably fixed the v2compat usage - the vjsf form is now compact by default - the 'show all processings' button now have a way better style * feat: add ts-config * fix: no .cjs, the breadcrumbs now displays * fix: better runs handling - Co-authored-by: BatLeDev * fix: the notifications card now shows properly on dark theme * fix: the breadcrumbs style is now properly applied * feat: better Vuetify instantiation - removed the manual css import from jsdelivr - changed the way the theme is accessed/edited on the store - you can now switch theme without triggering a reload - added vuetify, vite-plugin-vuetify - removed vuetify-nuxt-module - separated the vuetify instantiation from the session one in ui/plugins - the locale messages should be now properly interpreted * chore: added contributing guidelines, edited the readme, added some comments for non-trivial code and made the ui/sources files ESM-compatible * fix: the error page now works fine * chore: Small mistake in Docker instructions * fix: better menus - the menus now appears when the window is smaller, with a better color - fixed a bug where the icons would be dull - fixed all #activator templates - simplified icons in most v-btn - added the Show all processings in the small menu * fix: observer and tmpDir config * fix: config schema * fix: pass breadcrumbs to parent, better processing card styles, docker compose's data-fair config changed * feat: use data-fair/lib session and vuetify * fix: publicUrl * fix: small UI tweaks + vjsf 3.0.0-beta.5 * fix: main.scss * fix: some types * feat: add schema for processing * fix: processings run action should be triggered + vjsf update * feat: add typescript annotation * fix: runs actually works - fixed an issue with the api - added a progressbar when the processing config is edited. so you know why you can't (yet) run it - the webhook link is in code tags - running and deleting a processing have a progressbar as well and disables their respective buttons - fixed the Run processing button not emitting its trigger - fixed the duration method - the timestamps in runs are correctly displayed (sticked to the right) - removed notify from the websocket * chore: dev navbar * fix: errors correctly redirect to the error page + user check in processings * fix: add some types in api * feat: add type for permission * fix: some types errors * fix: correctly passes values to $fetch and better plugins page - update icon if the plugin can be updated - better display of the version - remove installed plugins from the available plugins list - sorts plugins by alphabetical order * fix: don't display an empty space under the plugins if there's no description * fix: better plugins deletion - don't prompt to run a processing with a deleted plugin - show a confirmation prompt before deleting a plugin * fix: processing menu now appears correctly on small screens + bump dayjs from 1.11.10 to 2.0.0-alpha.4 - see iamkun/dayjs#1281 * fix: websocket does not send data * fix: loading bar and apiKey * fix: better v-icon, better design on a processing's runs list, fixed build error and display the navbar only if we're not in an iframe * fix: the loading circle on processing's page is have a correct padding and better text * fix: task never stop * feat: show a status icon on each run step, creating a plugin now allows typing its name * fix: kill task with ui * feat: plugin input is clearable, display the number of installed/available plugins * fix: test failed * fix: worker dependencies version * feat: search processings - fixed 'mobile' menu for creating a processing - display in the processings list if one have been/is being killed * fix: consistent style on search elements + fixed the processing search looking like a D when filled * fix: type error * fix: some types * feat: display processings by run status * feat: plugin & processings search doesn't require to select elements anymore - processing's search & status works together - fixed an issue with vjsf validate * feat: add custom plugin name config + fix types in plugin and plugins-registry * chore: clean plugin router * fix: add types on create and get processings * fix: patch processing * chore: add comments is processings router * fix: validate the form, debounce the input * fix: avoid exceeding call stack * fix: run processing with delay + add JSDoc ts annotation + add shared to Dockerfile * feat: API documentation * fix: notify now works again * feat: complete plugins & limits doc * style: add summary on api doc * feat: complete processings part of API doc * fix: update version show when the disTag is different + fix axios moderate dependency warning + fix name of plugin in plugin page * fix: re-add privateDaraFairUrl & privateDirectoryUrl * fix: dataFairUrl & directoryUrl * fix: drop next run when scheduling type is 'trigger' + move createNext function to shared + add ts annotation * fix: add ts anotation + add 404 error when plugin not found + merge master in nuxt3 * feat: sort processings by planned, loading indicator when installing a plugin * fix: avoid concurrent patch * fix: end task properly * fix: avoid concurrent patch (actually) * feat: sort processings by plugin used (compatible with custom names and version agnostic) * chore : rename reqSession by sessionState + add department support on sd * chore: nuxt update to v3.11 - also updated all UI dependencies - uses the proper Nuxt3 components naming convention - uses the new Client Component feature from Nuxt 3.11.0 - deleted unused components - stops explicitely importing component and instead rely on Nuxt's Components dynamic import * fix: readd secondaryHost * fix: better processings sort by plugin - now also works when a plugin have been deleted - stops renaming the customName (made at first to remove the version but this also would remove everything in parenthesis on custom names) * chore: add better types for mongodb * fix: mongo db starting error * chore: added types annotations to all components * feat: add a query param into plugin-registry This param 'showAll' allow to get all plugins and their versions (distTag) * fix: req.param -> req.query + better tests for plugin-registry * feat: implement b50459f on UI's side * fix: test permissions, admin1 doesn't exist * chore: add better types in worker * fix: processing's config timezone now works as expected - killing a run now works instantly - ui's build noww works again - the show all option on plugins page have a more logical placement - processing's config now validates properly again * fix: test build images * fix: better patch with vjsf beta 9 * feat: added skeleton loaders - also fixed the Notifications snackbar * fix: data folder on build docker images * fix: runs correctly on build + notifications fix - added NODE_ENV as an ARG so we can provide it on build - removed USER node, as it won't work with volumes (created with root, containers then got no access) - the notifications component is now readable on mobile - fixed the skeleton loader having the wrong check on processings page * chore: removed pinia leftovers * feat: refacto of plugin.vue Visual Changes: - Refined the styling in index.vue for processings: the sidebars are now more compact. - Enhanced the appearance of search bars in both processings and plugins views to be more square-shaped, similar to the dataset page. - Improved the display of Skeleton loaders in plugins.vue. Functional Changes: - Enabled the ability to install multiple plugins simultaneously. (Very convenient 😍) - Enhanced the v-menu display for deletion Pending Fixes and Enhancements: - Fix the issue with the 'No' button not dismissing the v-menu. - Add try-catch blocks for both installation and deletion to handle errors gracefully. - Implement notifications in the catch blocks. * fix: hide delete plugin menu, mobile button is fixed and the owner avatar shows * chore: added NPM_HTTPS_PROXY env var related stuff from master * fix: readd v-iframe plugin and add better v-card style * chore: change plugin filter by composable date-format * chore: text update * feat: get processings list with facets (statuses) and filter by statuses * fix: readded skeleton loaders on processings list, removed the progress bar, fixed the patch * fix: correct height in data-fair iframe * feat: add facets and filters on plugins in processings endpoint * fix: sort filters * feat: filters displays in the URL * Added new params to the API doc * chore: small menu issue * feat: better aggregation in plugin endpoint for facets * fix: better minimum iframe height and passes url values to the mobile menu * fix: better skeleton loader display on light theme * feat: add facets count nb processings per plugins in plugin endpoint * feat: can't uninstall a plugin if it's used by > 0 processings, displays that info too * chore: update the API docs (facets in GET /plugins) * fix: permissions on department * chore: better description in PrivateAccess * fix: renamed showAll to showAllPlugins on the plugins page to avoid conflict with showAll on processings page * chore: add mongodb indexes * chore: make tests work * chore: configure husky * fix: types of plugins-registry.js * chore: use jsdoc linter + small implementation details * fix: wrong root routing * refactor: work on many small things * fix: missing prefix path in tests * chore: work on CI * chore: default config values * chore: docker on UI dockerfile * chore: work on dockerfiles * chore: some dependency management * chore: some dependency management * chore: some dependency management * chore: some dependency management * chore: some dependency management * fix: broken use of tmp-promise * fix: some regression due to dependency upgrades * chore: some dependency management * chore: some dependency management * chore: some dependency management * chore: better error display * fix: missing error management in UI * chore: better run requests in sequence * chore: send notif to parent iframe * fix: wrong var name * fix: error when access file is missing * fix: some reactivity problems * fix: wrong data dir in dev env * chore: various small changes * fix: a errors with session and navigation * fix: missing dep * fix: missing dep * fix: prevent null reference error * chore: use privateNotifyUrl config variable * fix: some vjsf error management problems * fix: remove additional properties in config * fix: regression in using secretKeys * chore: remove file that should be ignored * chore: ignore local configuration files * fix: broken unset logic * fix: configuring iframe-resizer doesn't work as a nuxt plugin * fix: try another way to configure iframe-resizer * fix: try another way to configure iframe-resizer * fix: try another way to configure iframe-resizer * fix: problem in vjsf wait for correct form validity * fix: missing customName in older plugins * fix: pull fixes from vjsf * fix: pull fixes from vjsf * fix: labels of buttons on permissions list * fix: broken contrib access * fix: missing python to install native deps * chore: small forms improvements * chore: small forms improvements * chore: small forms improvements * 2.0.0 * chore: temporarily activate quality checks on commit to test workflow * chore: add build-types script to CI * Revert "chore: temporarily activate quality checks on commit to test workflow" This reverts commit c3febff. * 2.0.1 * fix: npm config cannot run inside a workspace * 2.0.2 * fix: broken us of reactive search params * refactor: work on reactivity of processings page * chore: adapt to reactive search params new composables * chore: small changes * fix: disable autocomplet of password fields * fix: missing config for tmp dir * fix: broken breadcrumb * chore: use axios retry for more resilient http requests * feat: add tippecanoe to worker image * fix: some problems in debug mode and error management * 2.0.3 * fix: prevent null reference exception * 2.0.4 * fix: axios error interceptor incompatible with axios retry * fix: axios error interceptor incompatible with axios retry * fix: missing axios-retry in worker image * 2.0.5 * fix: wrong mails transport config structure * fix: upgrade vjsf * fix: upgrade vjsf * fix: broken edition and application of timezones * fix: upgrade vjsf * fix: missing native deps in worker image * refactor: use locks from @data-fair/lib --------- Co-authored-by: BatLeDev <[email protected]> Co-authored-by: Alban Mouton <[email protected]>
We want to make some changes to make Day.js modern and in a standard JS way.
And this would be a breaking change because of these changes below:
Make TypeScript definition the same behavior as JS code
Update
types/index.d.ts
toexport default dayjs;
Mark the correct ES6 Module entry
Update package.json "module" to "esm/index", (won't introduce in "dayjs", see #1281 (comment))Publish a new NPM package, maybe "dayjs-esm" to ship an ESM module with
package.json
module entry pointed to. ref #1242 (comment)The text was updated successfully, but these errors were encountered: