PageSourceSearch

https://nichbelize.org/wp-content/plugins/pie-calendar/includes/js/piecal-utils.js?ver=1.3.1.1

js nichbelize.org collected 2026-10-02 18:18:31 UTC 6,969 bytes, 192 lines download raw bytes

1(function() {
2    let piecalUtils = {
3        getAlldayMultidayEventEnd: function( event ) {
4            if( !event ) return undefined;
5
6            if(event.allDay && event.end) {
7                let eventStart = new Date(event.start);
8                let comparableEventStart = eventStart.toLocaleDateString('en-us');
9                let eventEnd = new Date(event.end);
10                let comparableEventEnd = eventEnd.toLocaleDateString('en-us');
11
12                if( comparableEventStart == comparableEventEnd ) return;
13
14                let trueDayNumber = parseInt(event.end.match(/-(\d{2})T/)[1], 10);
15                let convertedDayNumber = eventEnd.getDate();
16                
17                if( convertedDayNumber < trueDayNumber ) {
18                    eventEnd.setDate(eventEnd.getDate() + 2);
19                } else if( convertedDayNumber == trueDayNumber ) { 
20                    eventEnd.setDate(eventEnd.getDate() + 1);
21                }
22
23                let extendedEndDate = eventEnd.toISOString();
24
25                return {
26                    actualEnd: event.end, // Save original event end to use in popover
27                    end: extendedEndDate // Change event end to show it extending through the last day
28                }
29            }
30        },
31
32        getLocalizedDayNames: function( dayName, length, locale = '' ) {
33            if( !length ) return dayName;
34
35            let allowedLengths = ['full', 'short', 'single'];
36
37            if( !allowedLengths.includes(length) ) {
38                return dayName;
39            }
40
41            // Normalize locale before using it to lookup day names in dayNameMap
42            if( locale.includes( "-" ) ) {
43                locale = locale.split("-");
44
45                locale = locale[0];
46            }
47
48            let dayNameMap = {
49                // Hebrew
50                "he": {
51                    "יום ראשון": { // Sunday
52                        full: "יום ראשון",
53                        short: "א׳",
54                        single: "א׳"
55                    },
56                    "יום שני": { // Monday
57                        full: "יום שני",
58                        short: "ב׳",
59                        single: "ב׳" 
60                    },
61                    "יום שלישי": { // Tuesday
62                        full: "יום שלישי",
63                        short: "ג׳",
64                        single: "ג׳"
65                    },
66                    "יום רביעי": { // Wednesday
67                        full: "יום רביעי",
68                        short: "ד׳",
69                        single: "ד׳"
70                    },
71                    "יום חמישי": { // Thursday
72                        full: "יום חמישי",
73                        short: "ה׳",
74                        single: "ה׳"
75                    },
76                    "יום שישי": { // Friday
77                        full: "יום שישי",
78                        short: "ו׳",
79                        single: "ו׳"
80                    },
81                    "יום שבת": { // Saturday
82                        full: "יום שבת",
83                        short: "ש׳",
84                        single: "ש׳"
85                    }
86                },
87                // Arabic
88                "ar": {
89                    "السبت": { // Saturday
90                        full: "السبت",
91                        short: "س",
92                        single: "س"
93                    },
94                    "الأحد": { // Sunday
95                        full: "الأحد",
96                        short: "Ø­",
97                        single: "Ø­"
98                    },
99                    "الاثنين": { // Monday
100                        full: "الإثنين",
101                        short: "ن",
102                        single: "ن"
103                    },
104                    "الثلاثاء": { // Tuesday
105                        full: "الثلاثاء",
106                        short: "Ø«",
107                        single: "Ø«"
108                    },
109                    "الأربعاء": { // Wednesday
110                        full: "الأربعاء",
111                        short: "ر",
112                        single: "ر"
113                    },
114                    "الخميس": { // Thursday
115                        full: "الخميس",
116                        short: "Ø®",
117                        single: "Ø®"
118                    },
119                    "الجمعة": { // Friday
120                        full: "الجمعة",
121                        short: "ج",
122                        single: "ج"
123                    },     
124                },
125                // Icelandic
126                // Not supported by intl.DateTimeFormat, so we add it ourselves here
127                "is": {
128                    "Monday": {
129                        full: "Mánudagur",
130                        short: "Mán",
131                        single: "M"
132                    },
133                    "Tuesday": {
134                        full: "Þriðjudagur",
135                        short: "Þri",
136                        single: "Þ",
137                    },
138                    "Wednesday": {
139                        full: "Miðvikudagur",
140                        short: "Mið",
141                        single: "M"
142                    },
143                    "Thursday": {
144                        full: "Fimmtudagur",
145                        short: "Fim",
146                        single: "F"
147                    },
148                    "Friday": {
149                        full: "Föstudagur",
150                        short: "Fös",
151                        single: "F"
152                    },
153                    "Saturday": {
154                        full: "Laugardagur",
155                        short: "Lau",
156                        single: "L"
157                    },
158                    "Sunday": {
159                        full: "Sunnudagur",
160                        short: "Sun",
161                        single: "S"
162                    }
163                }
164            }
165
166            if (!(locale in dayNameMap) || 
167                ( !dayNameMap[locale][dayName] ||
168                !dayNameMap[locale][dayName][length] ) ) {
169                switch( length ) {
170                    case "full":
171                        return dayName;
172                    case "short":
173                        return dayName.substring(0, 3);
174                    case "single":
175                        return dayName.substring(0, 1);
176                }
177            }
178
179            return dayNameMap[locale][dayName][length] ?? dayName;
180        },
181
182        outputViewersTimezone: function( target ) {
183            if( !target ) return;
184
185            let viewerTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
186
187            target.innerHTML = viewerTimezone;
188        }
189    }
190
191    window.piecalUtils = piecalUtils;
192})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.