You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
❯ node ./index.js
Hello Node.js v18.20.3!
true false
false true
true
true
Error: Invalid unit _timestamp
at normalizeComponent (/home/projects/stackblitz-starters-nt1w2a/node_modules/data-utils-new/build/utils/utils.js:158:11)
at normalizeDateComponents (/home/projects/stackblitz-starters-nt1w2a/node_modules/data-utils-new/build/utils/utils.js:174:20)
at getTimestampFromObject (/home/projects/stackblitz-starters-nt1w2a/node_modules/data-utils-new/build/dateTime/parse.js:27:58)
at getTimestamp (/home/projects/stackblitz-starters-nt1w2a/node_modules/data-utils-new/build/dateTime/dateTime.js:646:49)
at dateTime (/home/projects/stackblitz-starters-nt1w2a/node_modules/data-utils-new/build/dateTime/dateTime.js:680:14)
at parseInput (/home/projects/stackblitz-starters-nt1w2a/node_modules/data-utils-new/build/parser/parser.js:24:40)
at dateTimeParse (/home/projects/stackblitz-starters-nt1w2a/node_modules/data-utils-new/build/parser/parser.js:43:16)
at Object.isValid (/home/projects/stackblitz-starters-nt1w2a/node_modules/data-utils-new/build/parser/parser.js:56:42)
at Object.eval (/home/projects/stackblitz-starters-nt1w2a/index.js:20:20)
at Object._0x34b746 (https://stackblitzstartersnt1w2a-5cqf.w-credentialless-staticblitz.com/blitz.34c588ed.js:40:792686)
Node.js v18.20.3
We have a complex backoffice project. Different teams are putting together different subprojects using different date-utils. Different people are responsible for updating. All subprojects are integrated into one big one. Periodically, situations arise when in a common big project we have several versions that differ by a patch (e.g. 2.5.3 & 2.5.4). This leads to the breakdown of the entire frontend.
isValid function shouldn't throw on incorrect input.
DateTimeImpl doesn't work with inputs of type DateTime that are not DateTimeImpl instances.
isDateTime returns false for different version instances.
The first two issues are bugs (fixed here #80) but the last one is not. The library uses the Singleton pattern and this pattern cannot be supported across different versions of the package, even if they have the same version number. It is highly recommended to get rid of multiple versions of a package. This can be done in several ways, such as using overrides in package.json, aliases in bundlers.
IMHO It is not typical for the NPM world to have two different patch packages without backward compatibility. Can this situation be fixed?
There are no backward compatibility issues. The public APIs of these two versions are backward compatible.
isValid function shouldn't throw on incorrect input.
DateTimeImpl doesn't work with inputs of type DateTime that are not DateTimeImpl instances.
isDateTime returns false for different version instances.
The first two issues are bugs (fixed here #80) but the last one is not. The library uses the Singleton pattern and this pattern cannot be supported across different versions of the package, even if they have the same version number. It is highly recommended to get rid of multiple versions of a package. This can be done in several ways, such as using overrides in package.json, aliases in bundlers.
IMHO It is not typical for the NPM world to have two different patch packages without backward compatibility. Can this situation be fixed?
There are no backward compatibility issues. The public APIs of these two versions are backward compatible.
Sandbox: https://stackblitz.com/edit/stackblitz-starters-nt1w2a?file=package.json
We have a complex backoffice project. Different teams are putting together different subprojects using different
date-utils
. Different people are responsible for updating. All subprojects are integrated into one big one. Periodically, situations arise when in a common big project we have several versions that differ by a patch (e.g. 2.5.3 & 2.5.4). This leads to the breakdown of the entire frontend.The
isValid(...)
used in @gravity-ui/date-components : https://github.com/gravity-ui/date-components/blob/1d0f842b521255c31fbd1cd9839fcd1f8ee55e5f/src/components/DateField/hooks/useDateFieldState.ts#L87IMHO It is not typical for the NPM world to have two different patch packages without backward compatibility. Can this situation be fixed?
The text was updated successfully, but these errors were encountered: