Skip to content
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

refac(dayjs): refactoring duration internal constants #2403

Closed
wants to merge 3 commits into from
Closed

refac(dayjs): refactoring duration internal constants #2403

wants to merge 3 commits into from

Conversation

ssi02014
Copy link

@ssi02014 ssi02014 commented Aug 8, 2023

Hello 👋 @iamkun Thank you for sharing such a great library.

It would be nice to have MILLISECONDS_A_YEAR and MILLISECONDS_A_MONTH inside duration managed together in "constants.js", what do you think?

let $d
let $u
let $d = null
let $u = null
Copy link
Author

@ssi02014 ssi02014 Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initialized it to null to explicitly write that the value is currently empty.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason to initialize it to null, can we simply use let $d?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamkun
Yes, my initial intention was to explicitly initialize null to indicate that there is no current value, but I'll revert back to that.

@ssi02014 ssi02014 changed the title refac(dayjs): refactoring constant management refac(dayjs): refactoring duration Aug 8, 2023
@okinawaa
Copy link

okinawaa commented Aug 8, 2023

good👍

@ssi02014 ssi02014 changed the title refac(dayjs): refactoring duration refac(dayjs): refactoring duration internal constants Aug 8, 2023
@iamkun
Copy link
Owner

iamkun commented Sep 19, 2023

The reason to have a constant in duration plugin rather than in the common constant is that the src/constant will be bundled to the core package, not to the plugin, which will increase the package size.

@ssi02014
Copy link
Author

ssi02014 commented Sep 20, 2023

@iamkun

The reason to have a constant in duration plugin rather than in the common constant is that the src/constant will be bundled to the core package, not to the plugin, which will increase the package size.

Does this make a big difference in package size?
I thought it would be better to manage them together in line with the purpose of constants.

@iamkun
Copy link
Owner

iamkun commented Sep 20, 2023

@iamkun

The reason to have a constant in duration plugin rather than in the common constant is that the src/constant will be bundled to the core package, not to the plugin, which will increase the package size.

Does this make a big difference in package size? I thought it would be better to manage them together in line with the purpose of constants.

This is because not everyone needs the duration plugin, and should not download these constants in the core module

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (2254635) 100.00% compared to head (f811a89) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##               dev     #2403   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          183       183           
  Lines         2249      2249           
  Branches       636       636           
=========================================
  Hits          2249      2249           
Files Changed Coverage Δ
src/plugin/duration/index.js 100.00% <ø> (ø)
src/constant.js 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ssi02014
Copy link
Author

@iamkun I understand, I thought it was a very small difference. 🙏

@ssi02014 ssi02014 closed this Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants