line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Jifty::DBI::Filter::Date; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
11
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
71
|
|
4
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
62
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
9
|
use base qw|Jifty::DBI::Filter::DateTime|; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
514
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
14
|
use constant _time_zone => 'floating'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
113
|
|
9
|
3
|
|
|
3
|
|
9
|
use constant _strptime => '%Y-%m-%d'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
87
|
|
10
|
3
|
|
|
3
|
|
10
|
use constant date_only => 1; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
108
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 NAME |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Jifty::DBI::Filter::Date - DateTime object wrapper around date columns |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
This filter allow you to work with DateTime objects that represent "Dates", |
19
|
|
|
|
|
|
|
store everything in the database in GMT and not hurt yourself badly |
20
|
|
|
|
|
|
|
when you pull them out and put them in repeatedly. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 encode |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
If value is a DateTime object then move it into a "floating" timezone |
25
|
|
|
|
|
|
|
and expand it into ISO 8601 format C. By storing it in |
26
|
|
|
|
|
|
|
the database as a floating timezone, it doesn't matter if the user's |
27
|
|
|
|
|
|
|
desired timezone changes between lookups |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Does nothing if value is not defined or is a string. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 decode |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
If we're loading something from a column that doesn't specify times, then |
36
|
|
|
|
|
|
|
it's loaded into a floating timezone. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
If value is defined then converts it into DateTime object otherwise do |
39
|
|
|
|
|
|
|
nothing. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SEE ALSO |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
L, L |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |