Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Export formatDate function #1286

Merged
merged 1 commit into from
Feb 19, 2020
Merged

Export formatDate function #1286

merged 1 commit into from
Feb 19, 2020

Conversation

helloneele
Copy link
Contributor

@helloneele helloneele commented Feb 18, 2020

Description

This exports the formatDate function so we can reuse it in @shopify/react-i18n and in shopify web directly. This will reduce code duplication and hopefully also eliminate more memory leaks once we use it.

I'll put up a follow-up PR for the @shopify/react-i18n package that makes use of this function.
Follow up PR: #1287

Type of change

  • Patch: Bug/ Documentation fix (non-breaking change which fixes an issue or adds documentation)
  • Minor: New feature (non-breaking change which adds functionality)
  • Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above

Copy link
Contributor

@michenly michenly left a comment

Choose a reason for hiding this comment

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

please add some documentation on 1. when would someone want to use this utility 2. how would someone use this utility.

@helloneele
Copy link
Contributor Author

@michenly Oh, didn't realize there was documentation in the readme, sorry. Should be good now 🙂

hour: 'numeric',
};

const newDate = formatDate(date, locales, options); // 9 AM
Copy link
Contributor

Choose a reason for hiding this comment

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

The new date is just 9 AM?

Copy link
Contributor Author

@helloneele helloneele Feb 19, 2020

Choose a reason for hiding this comment

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

Yeah, it's based on the options you pass it apparently. By doing hour: 'numeric' it'll just return the hour. If you don't specify hour it'll give you the date like this 2/18/2020

Copy link
Contributor

@michenly michenly left a comment

Choose a reason for hiding this comment

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

It looks great to me!

@helloneele helloneele merged commit 5a2d593 into master Feb 19, 2020
@helloneele helloneele deleted the dates-export-formatDate branch February 19, 2020 14:38
@michenly michenly temporarily deployed to production February 19, 2020 16:08 Inactive
@vsumner vsumner deployed to just-use-act-beta February 19, 2020 20:05 Active
@helloneele helloneele deployed to beta-test-reacti18n-memory-leak-fix February 20, 2020 20:41 Active
@carysmills carysmills deployed to beta-test-formatting-12-hr-dates February 26, 2020 19:32 Active
@helloneele helloneele deployed to test-use-memoized-number-format March 6, 2020 19:25 Active
@TayKangSheng TayKangSheng deployed to expand_locale_support_for_shopify_address March 9, 2020 08:16 Active
@michenly michenly temporarily deployed to gem March 24, 2020 21:43 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants