logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Data::Fake::Dates - Fake date data generators

Author

       David Golden <dagolden@cpan.org>

Description

       This module provides fake data generators for past and future dates and times.

       All functions are exported by default.

Functions

fake_past_epoch
           $generator = fake_past_epoch();

       This returns a generator that gives a randomly-selected integer number of seconds between the Unix epoch
       and the current time.

   fake_future_epoch
           $generator = fake_future_epoch();

       This returns a generator that gives a randomly-selected integer number of seconds between the the current
       time and a period as far into the future as the Unix epoch is in the past (i.e. about 45 years as of
       2015).

   fake_past_datetime
           $generator = fake_past_datetime();
           $generator = fake_past_datetime("%Y-%m-%d");
           $generator = fake_past_datetime($strftime_format);

       This returns a generator that selects a past datetime like "fake_past_epoch" does but formats it as a
       string using FreeBSD-style "strftime" formats.  (See Time::Piece for details.)

       The default format is ISO8601 UTC "Zulu" time ("%Y-%m-%dT%TZ").

   fake_future_datetime
           $generator = fake_future_datetime();
           $generator = fake_future_datetime("%Y-%m-%d");
           $generator = fake_future_datetime($strftime_format);

       This returns a generator that selects a future datetime like "fake_future_epoch" does but formats it as a
       string using FreeBSD-style "strftime" formats.  (See Time::Piece for details.)

       The default format is ISO8601 UTC "Zulu" time ("%Y-%m-%dT%TZ").

Name

       Data::Fake::Dates - Fake date data generators

Synopsis

           use Data::Fake::Dates;

           $past   = fake_past_epoch()->();
           $future = fake_future_epoch()->();

           $past   = fake_past_datetime()->();     # ISO-8601 UTC
           $future = fake_future_datetime()->();   # ISO-8601 UTC

           $past   = fake_past_datetime("%Y-%m-%d")->();
           $future = fake_future_datetime("%Y-%m-%d")->();

Version

       version 0.006

See Also