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