Skip to content

feat(locale): add setTimezone & getTimezone functions#992

Merged
ShGKme merged 1 commit intonextcloud-libraries:mainfrom
Sector6759:timezone
Dec 22, 2025
Merged

feat(locale): add setTimezone & getTimezone functions#992
ShGKme merged 1 commit intonextcloud-libraries:mainfrom
Sector6759:timezone

Conversation

@Sector6759
Copy link
Copy Markdown
Contributor

@Sector6759 Sector6759 commented Dec 16, 2025

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.65%. Comparing base (d9d9de8) to head (d3c8cf2).
⚠️ Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #992      +/-   ##
==========================================
+ Coverage   83.16%   83.65%   +0.48%     
==========================================
  Files           6        6              
  Lines         202      208       +6     
  Branches       84       86       +2     
==========================================
+ Hits          168      174       +6     
  Misses         24       24              
  Partials       10       10              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Sector6759
Copy link
Copy Markdown
Contributor Author

Sector6759 commented Dec 16, 2025

@ShGKme @susnux

Due to https://github.com/nextcloud-libraries/nextcloud-capabilities/blob/main/lib/index.ts#L11

console.debug('Could not find capabilities initial state fall back to _oc_capabilities')

the console output of the test runs now gets spammed with this message. We could switch to calling

loadState('core', 'capabilities')

directly, to circumvent this.

Copy link
Copy Markdown
Contributor

@ShGKme ShGKme left a comment

Choose a reason for hiding this comment

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

Looks good.

But we need to double-check that the timezone format from capabilities is the same as Intl supports

Comment thread tests/locale.test.ts Outdated
Comment thread lib/locale.ts Outdated
@ShGKme
Copy link
Copy Markdown
Contributor

ShGKme commented Dec 16, 2025

Due to https://github.com/nextcloud-libraries/nextcloud-capabilities/blob/main/lib/index.ts#L11

console.debug('Could not find capabilities initial state fall back to _oc_capabilities')

the console output of the test runs now gets spammed with this message. We could switch to calling

loadState('core', 'capabilities')

directly, to circumvent this.

I wouldn't change the used library in the main code due to spam log messages in the tests.

We should either silent the log in the tests or fix the library.

@Sector6759
Copy link
Copy Markdown
Contributor Author

But we need to double-check that the timezone format from capabilities is the same as Intl supports

What do you mean by this? One of the following?

  • Ensuring the timezone from the capabilities being a named IANA time zone
  • Ensuring every time zone possibly set in the personal settings section being supported by the constructors and methods in the Intl namespace

@Sector6759
Copy link
Copy Markdown
Contributor Author

We should either silent the log in the tests or fix the library.

We could pass --silent=passed-only as a CLI option to vitest, but I'm not the one to decide on that.

@susnux
Copy link
Copy Markdown
Contributor

susnux commented Dec 16, 2025

We could pass --silent=passed-only as a CLI option to vitest, but I'm not the one to decide on that.

Or just silence the specific output by having vi.spyOn(console, 'debug').mockImplementation(() => {])

@Sector6759
Copy link
Copy Markdown
Contributor Author

Or just silence the specific output by having vi.spyOn(console, 'debug').mockImplementation(() => {])

I've added that line to the getTimezone tests.

Comment thread lib/locale.ts Outdated
@susnux susnux added type: enhancement 🚀 New feature or request 3. to review 3️⃣ Waiting for reviews labels Dec 17, 2025
Copy link
Copy Markdown
Contributor

@ShGKme ShGKme left a comment

Choose a reason for hiding this comment

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

Thanks!

Could you squash into a single commit, since all the changes where only "fixups" from the review in a small feature?

@Sector6759
Copy link
Copy Markdown
Contributor Author

Could you squash into a single commit, since all the changes where only "fixups" from the review in a small feature?

Isn't that something one of you guys have to do when merging?

From the docs:

To squash and merge pull requests, you must have write permissions in the repository, and the repository must allow squash merging.

@ShGKme
Copy link
Copy Markdown
Contributor

ShGKme commented Dec 19, 2025

Isn't that something one of you guys have to do when merging?

We don't have merge squash. But you can do anything in your own branch, including squashing into a single commit, and force-push

Signed-off-by: Sector6759 <149817326+Sector6759@users.noreply.github.com>
@Sector6759
Copy link
Copy Markdown
Contributor Author

Sector6759 commented Dec 19, 2025

Alright, I've squashed the commits.

@ShGKme ShGKme merged commit 3d02991 into nextcloud-libraries:main Dec 22, 2025
9 checks passed
@Sector6759 Sector6759 deleted the timezone branch December 22, 2025 11:35
@Sector6759 Sector6759 mentioned this pull request Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review 3️⃣ Waiting for reviews type: enhancement 🚀 New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: implement a getTimeZone function

3 participants