feat(twas): refracto to use intl api
Use intl api instead of dep
has been extensively tested
That's not right my lib have more test case and 100% test coverage. I'm working on CI that test the package on deno and bun
On the other hand, the library you suggest you just created it recently, exactly one hour ago, which implies that it has not yet been sufficiently evaluated in different scenarios. Also, since Deno is compatible with NPM, it is not strictly necessary to migrate to a library published in JSR unless there is a compelling reason, such as a deprecation or a significant advantage.
I agree with you on much of it. But don't forget that SJR's source code represents the entire project. And if it's too dependent on NPM, it's not very serious: a registry that needs another registry to function is “the snake that dies on its own tail”.
After reviewing the original package alongside your proposed implementation, I've noticed that the way time interval and time difference calculations are handled is very similar to the code found in this repository (the current package used), which is licensed under MIT. The logic and structure are nearly identical, and they even share the same naming conventions and package name—aside from a few added configuration and test files.
Could you please confirm whether both codebases have been carefully compared for any discrepancies, and that the proper MIT license attribution is maintained in both cases? This similarity reinforces my earlier point that the changes may not provide a significant improvement or benefit overall compared with current package.
Could you please confirm whether both codebases have been carefully compared for any discrepancies, and that the proper MIT license attribution is maintained in both cases? This similarity reinforces my earlier point that the changes may not provide a significant improvement or benefit overall compared with current package.
That just a rewrite in typescript and "modernize". According to my research, this should not violate the MIT license.
I would actually be in favour of not using a dependency, and instead use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat (or Duration from temporal)
I would actually be in favour of not using a dependency, and instead use https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat (or Duration from temporal)
I'll try to see how to use Intl
just looked at this live, and seems it is kinda too detailed. @kt3k could you advise here?
I would only show the largest unit like:
if (duration.years >= 1) {
return formatter.format({ years: duration.years }) + " ago";
} else if (duration.months >= 1) {
return formatter.format({ months: duration.months }) + " ago";
} else if (duration.days => 1) {
return formatter.format({ days: duration.days }) + " ago";
} else if (duration.hours >= 1) {
return formatter.format({ hours: duration.hours }) + " ago";
} ...
FYI I do something like this in my blog implementation (using Temporal.Duration object) https://github.com/kt3k/times-kt3k/blob/8353c9c4f15e23b090b7a467f098348c968be7cd/components/post.tsx#L60-L72
hummm interesting !
Also, take a look at https://github.com/denoland/saaskit/blob/ba68c58ead38e97fe6c469e4ca73a464703568a5/utils/display.ts#L31-L54