ngneat / falso

All the Fake Data for All Your Real Needs 🙂

Home Page:https://ngneat.github.io/falso/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add incermentalDate function to factories

shaharkazaz opened this issue · comments

Description

A common use case in applications is showing an incremental date, for example, a time series chart. We proposed the following API:

General API

const dateFactory: () => Date | undefined = incermentalDate({ from, to?, step: milliseconds })

Example

const dateFactory = incermentalDate({ 
  from: new Date('2022-06-01'), 
  to: new Date('2022-06-25'),
  step: millisecondsInDay
});

dateFactory() // 2022-06-01
dateFactory() // 2022-06-02
dateFactory() // 2022-06-03
...
dateFactory() // 2022-06-25
dateFactory() // undefined

Proposed solution

No response

Alternatives considered

No response

Do you want to create a pull request?

No