Flagsmith / Flagsmith/flagsmith-js-client

Feature request: support `Date` objects as traits

Open
#329 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
67
Forks
45
Avg merge
1d 8h
Merged PRs (30d)
4

Description

OpenFeature supports [Datetime types](https://openfeature.dev/specification/types#datetime) for context attributes, but [Flagsmith traits do not](https://github.com/Flagsmith/flagsmith-js-client/blob/26ae6181b38a569b09db1af9f4210d1a8fe3fa98/types.d.ts#L3).

Because of this, the OpenFeature provider has to make a copy of all the traits and map any `Date` objects into strings, which we've added in https://github.com/open-feature/js-sdk-contrib/pull/1351. The OpenFeature provider could potentially have some smarter logic/caching to avoid this copying, but this is overkill for what should be a simple adapter on top of the Flagsmith SDK.

Ideally, the Flagsmith SDK should natively support `Date` objects, and only serialise them into strings when needed. This avoids having to make a copy of the entire evaluation context whenever it changes, and makes the OpenFeature provider implementation simpler and faster.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.