Comments (3)
Isn't there some kind of common library that can represent a range of dates (EG a range from 17 years ago
to 18 years ago
) so we can just Enum.random
it?
from faker.
Date Ranges are a 1.6 feature from the looks of things
https://github.com/elixir-lang/elixir/blob/741b6adbd8c4be1735dc9c605b8d5cdc7b73bc1a/lib/elixir/lib/calendar/date_range.ex#L1
Perhaps something like this https://medium.com/@natetsai/implementing-date-ranges-in-elixir-384460f3b7fa ?
or this seems very tidy https://stackoverflow.com/questions/30951318/how-to-create-a-stream-and-list-of-dates
from faker.
Fixed by MR #116
Enum.map(0..1000, fn i -> Faker.Date.date_of_birth(1).day end)
|> Enum.reduce(%{}, fn day, acc -> Map.update(acc, day, 0, &(&1 + 1)) end)
%{1 => 40, 2 => 27, 3 => 35, 4 => 39, 5 => 25, 6 => 32, 7 => 21, 8 => 18,
9 => 37, 10 => 28, 11 => 24, 12 => 28, 13 => 27, 14 => 30, 15 => 43, 16 => 26,
17 => 31, 18 => 29, 19 => 36, 20 => 31, 21 => 31, 22 => 38, 23 => 21,
24 => 41, 25 => 42, 26 => 32, 27 => 39, 28 => 36, 29 => 44, 30 => 29,
31 => 10}
from faker.
Related Issues (20)
- New release? HOT 1
- Problems when instantiating Faker in iex, I followed the documentation guide but it didn't help me much, can someone help me, I'm using Phoenix Framework HOT 2
- Faker.Name.PtBr.first_name/0 is undefined HOT 2
- Avatar url is redirected HOT 1
- Virgin Islands extra split
- Faker.Phone.EnUs.phone() produces invalid phone numbers HOT 2
- Feature request: Timezone
- Utilities for non-deterministic data generation
- Compile issue with Elixir 1.13 HOT 5
- invalid bidirectional formatting character in string: \u202A HOT 2
- compile error on elixir latest 1.13.12 HOT 2
- Faker.Blockchain.Ethereum.address/0 may return invalid addresses HOT 1
- Option to make any generated data unique HOT 1
- Faker.Vehicle.vin() does not always generate valid VINs
- feature: increase API compatibility with FakerElixir
- Release new version HOT 2
- Dependency Dashboard
- Faker.Date.date_of_birth() is failing on 29/2 HOT 5
- Faker.Date.date_of_birth() generates invalid dates when called on a leap date HOT 2
- Compile warnings with Elixir 1.17 rc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from faker.