1Prima::Calendar(3) User Contributed Perl Documentation Prima::Calendar(3)
2
3
4
6 Prima::Calendar - standard calendar widget
7
9 use Prima::Calendar;
10 my $cal = Prima::Calendar-> create(
11 useLocale => 1,
12 onChange => sub {
13 print $_[0]-> date_as_string, "\n";
14 },
15 );
16 $cal-> date_from_time( localtime );
17 $cal-> month( 5);
18
20 Provides interactive selection of date between 1900 and 2099 years.
21 The main property, date, is a three-integer array, day, month, and
22 year, in the format of perl localtime ( see "localtime" in perlfunc ) -
23 day can be in range from 1 to 31,month from 0 to 11, year from 0 to
24 199.
25
27 Events
28 Change
29 Called when the date property is changed.
30
31 Properties
32 date DAY, MONTH, YEAR
33 Accepts three integers in format of "localtime". DAY can be from 1
34 to 31, MONTH from 0 to 11, YEAR from 0 to 199.
35
36 Default value: today's date.
37
38 day INTEGER
39 Selects the day in month.
40
41 firstDayOfWeek INTEGER
42 Selects the first day of week, an integer between 0 and 6, where 0
43 is Sunday is the first day, 1 is Monday etc.
44
45 Default value: 0
46
47 month
48 Selects the month.
49
50 useLocale BOOLEAN
51 If 1, the locale-specific names of months and days of week are
52 used. These are read by calling "POSIX::strftime". If invocation
53 of POSIX module fails, the property is automatically assigned to 0.
54
55 If 0, the English names of months and days of week are used.
56
57 Default value: 1
58
59 See also: date_as_string
60
61 year
62 Selects the year.
63
64 Methods
65 can_use_locale
66 Returns boolean value, whether the locale information can be
67 retrieved by calling "strftime".
68
69 month2str MONTH
70 Returns MONTH name according to useLocale value.
71
72 make_months
73 Returns array of 12 month names according to useLocale value.
74
75 day_of_week DAY, MONTH, YEAR, [ USE_FIRST_DAY_OF_WEEK = 1 ]
76 Returns integer value, from 0 to 6, of the day of week on DAY,
77 MONTH, YEAR date. If boolean USE_FIRST_DAY_OF_WEEK is set, the
78 value of "firstDayOfWeek" property is taken into the account, so 0
79 is a Sunday shifted forward by "firstDayOfWeek" days.
80
81 The switch from Julian to Gregorian calendar is ignored.
82
83 date_as_string [ DAY, MONTH, YEAR ]
84 Returns string representation of date on DAY, MONTH, YEAR according
85 to useLocale property value.
86
87 date_from_time SEC, MIN, HOUR, M_DAY, MONTH, YEAR, ...
88 Copies date from "localtime" or "gmtime" result. This helper method
89 allows the following syntax:
90
91 $calendar-> date_from_time( localtime( time));
92
94 Dmitry Karasik, <dmitry@karasik.eu.org>.
95
97 Prima, Prima::Widget, POSIX, "localtime" in perlfunc, "time" in
98 perlfunc, examples/calendar.pl.
99
100
101
102perl v5.28.0 2017-02-28 Prima::Calendar(3)