Timestamp attributes are now supported in Vercel Flags
Vercel Flags now allows targeting by date and time using timestamp attributes, enabling time-based campaign and user segmentation through dashboard or CLI configurations.
Vercel Flags has introduced support for timestamp attributes, enabling developers to target entities based on specific dates and times. This feature allows campaigns to be displayed only within defined date ranges, promotions to run during specific periods, or user segments to be filtered by registration dates. The functionality is accessible either through the Vercel dashboard or via the command-line interface, providing flexibility in configuration.
To implement timestamp attributes, users can navigate to the Vercel dashboard, open Flags, select Entities, and create or modify an entity. Within the entity settings, an attribute can be added with its data type set to timestamp. Alternatively, the same configuration can be achieved using the Vercel CLI, ensuring consistency across deployment methods.
Once configured, applications must provide the timestamp value when evaluating a flag. The entity and attribute names must align with the configuration, and the value must be a Unix epoch timestamp in milliseconds. The Vercel Flags SDK example demonstrates passing the current time using Date.now(), which returns the required millisecond value, ensuring accurate time-based evaluations.
In the dashboard, timestamp attributes can be used to create targeting rules for flags. These rules support comparisons such as 'is after,' 'is at or after,' 'is before,' and 'is at or before,' with the date and time picker defaulting to the user's local timezone. The CLI also supports adding date ranges to flags, allowing for precise release timing. Full documentation is available for further guidance on implementation.