Skip to content

feat: Product releaseDate - #1438

Merged
tlgimenes merged 2 commits into
mainfrom
feat/releaseDate
Aug 15, 2022
Merged

tlgimenes merged 2 commits into
mainfrom
feat/releaseDate

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Aug 15, 2022 •

Copy link
Copy Markdown
Contributor

What's the purpose of this pull request?

This PR is a one liner that returns the product's release date using schema.org's field on Product entity. This should fix this issue

Starters Deploy Preview

I tried adding this to gatsby too, however, gatsby library does not accept releaseDate as input

References

@vercel

vercel Bot commented Aug 15, 2022 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
faststore ✅ Ready (Inspect) Visit Preview Aug 15, 2022 at 4:19PM (UTC)

@codesandbox-ci

codesandbox-ci Bot commented Aug 15, 2022 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d811f24:

Sandbox Source
Store UI Typescript Configuration

@tlgimenes
tlgimenes marked this pull request as ready for review August 15, 2022 17:15
@tlgimenes
tlgimenes requested a review from a team as a code owner August 15, 2022 17:15

@filipewl filipewl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀

@tlgimenes
tlgimenes merged commit 255b236 into main Aug 15, 2022
@tlgimenes
tlgimenes deleted the feat/releaseDate branch August 15, 2022 17:52
lariciamota added a commit that referenced this pull request Oct 2, 2026
…-LD (#3508)

## What

Puts `StoreProduct.releaseDate` back to the raw value Intelligent Search
returns. The ISO 8601 normalization added in #3465 now runs only where
the PDP builds its `application/ld+json`.

| | Before (4.7.0 – 4.8.x) | After |
|---|---|---|
| `StoreProduct.releaseDate` (GraphQL) | `"2026-03-23"` |
`"1774224000000"`, as returned upstream (same as before 4.7.0) |
| PDP JSON-LD `releaseDate` | `"2026-03-23"` | `"2026-03-23"`, unchanged
|

## Why

#3465 (SO-666) needed an ISO date in the structured data, but it did the
normalization in the API resolver. That changed the field's format for
everyone who reads it, and store customizations that parse the epoch-ms
value broke. Search & Recommendation reported this as a bug against FS
4.8.0, related feature ELOR-5408. The change first shipped in 4.7.0.

The JSON-LD is the only consumer that needs ISO, and it is built in
`@faststore/core`, so the conversion now lives there.

## Changes

- **`@faststore/api`**: the resolver returns `releaseDate ?? ''` again,
and `utils/releaseDate.ts` is removed. The schema description no longer
says ISO 8601, because upstream doesn't guarantee that format. The type
stays `String!`.
- **`@faststore/core`**: the normalizer moves to
`src/utils/productJsonLd.ts` as `toProductJsonLdReleaseDate`, next to
`toProductJsonLdOffer`. `p.tsx` applies it only to `ProductJsonLd`. Its
behavior is unchanged: epoch ms or seconds and ISO strings become a UTC
calendar day, and empty or unparseable input gives `''`.
- **Generated**: `__generated__/schema.ts` and `@generated/graphql.ts`
were regenerated with codegen. Only the description text changed.

## Notes for review

- **Behavior change**: this reverts the format change from 4.7.0. A
store that already adapted to ISO on 4.7 or 4.8 gets epoch ms again.
That seems unlikely, since the ISO format was out for about a month and
the epoch format had been the contract since #1438, but it should go in
the changelog.
- **Hotfix to `main`**: this targets `main` directly, following the
precedent of #3437 (4.5.1), so it ships as **4.9.1** without waiting for
the next `dev → main` graduation. It should be back-merged into `dev`
afterwards. There are no 4.7.x/4.8.x maintenance branches, so stores on
4.7 or 4.8 get the fix by bumping to 4.9.1.

## Testing

- `packages/api`: the resolver tests pass (25). The new `releaseDate`
tests check that epoch ms and ISO values come through unchanged and that
null or undefined give `''`.
- `packages/core`: `productJsonLd.test.ts` and
`productJsonLdRendering.test.tsx` pass (37). This includes the 13
normalizer cases that moved over from the API.
- `tsc --noEmit` reports no errors in `src` for either package, and
Biome is clean.
- [ ] Render the reported SKU through `ci/codesandbox`. Check that a
customization reading `releaseDate` gets epoch ms and that the JSON-LD
still passes the Google Rich Results Test.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Improvements**
* Product data now returns catalog-provided release dates unchanged, or
an empty string when no value is available.
* Structured product metadata converts interpretable release dates to
UTC dates and omits missing or invalid dates.
* Structured metadata supports release dates provided as epoch
milliseconds, epoch seconds, or ISO 8601 strings.
  * Empty product identifiers are omitted from structured metadata.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — d811f242 Deployed Aug 15, 2022 by vercel[bot]
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