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

Added helpers for formatting timezones #96

Merged
merged 3 commits into from
Nov 29, 2021
Merged

Conversation

ronan-f
Copy link
Contributor

@ronan-f ronan-f commented Nov 26, 2021

I would like to propose we add the following methods to the date time helpers:

  1. formatDateFromTimestamp
  2. formatTimeFromTimestamp

This seems consistent with the other formatting helpers which provide options for formatting the date or time individually and allows more flexibility for consumers using timestamps.

Another thought I had was to expose the parseLocalDateTimeFromTimestamp method and allow consumers to format the resulting Date object however they want. I'm not sure if that would be a preferable option in this case.

lib/dateTime.js Outdated
@@ -1128,10 +1128,24 @@ export function formatDateTime(date, options) {

}

export function formatDateTimeFromTimestamp(timestamp, options) {
function parseLocalDateTimeFromTimestamp(timestamp, options) {
Copy link
Contributor Author

@ronan-f ronan-f Nov 26, 2021

Choose a reason for hiding this comment

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

Methods which return JS Date objects seem to be named parse<dateFormat> so I tried to keep that consistent here.

lib/dateTime.js Outdated Show resolved Hide resolved
lib/dateTime.js Outdated Show resolved Hide resolved
@ronan-f ronan-f requested a review from margaree November 29, 2021 15:30
Copy link
Contributor

@margaree margaree 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! Do you have merging permissions? If so, when you merge if you append feat: to the merge commit message then it will update the version (https://github.com/BrightspaceUI/intl#versioning--releasing)

@ronan-f ronan-f merged commit 7caa2eb into main Nov 29, 2021
@ronan-f ronan-f deleted the rfegan/add-timestamp-helpers branch November 29, 2021 15:37
@ghost
Copy link

ghost commented Nov 29, 2021

🎉 This PR is included in version 3.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ghost ghost added the released label Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants