Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Mar 14th, 2018 64 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. has_field 'date_time' => (
  2.     type => 'Compound',
  3.     apply => [
  4.                {
  5.                    transform => sub { DateTime->new( shift ) },
  6.                    message => 'This is not a correct date',
  7.                }
  8.                {
  9.                    check => sub { shift->day_of_week == 1 },
  10.                    message => 'Only Mondays allowed',
  11.                }
  12.              ],
  13. );
  14. has_field 'date_time.year' => (
  15.     type => 'Integer',
  16. );
  17. has_field 'date_time.month' => (
  18.     type => 'Integer',  
  19.     apply => [ { check => sub { my $month = shift; return $month > 0 && $month <= 12 } ]
  20. );
  21. has_field 'date_time.day' => (
  22.     type => 'Integer',
  23.     apply => [ { check => sub { my $day = shift; return $day > 0 && $day <= 31 } ]
  24. );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top