10 examples of 'javascript leapyear' in JavaScript

Every line of 'javascript leapyear' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
80function isLeapYear(year) {
81 return (year % 4 == 0 && year % 100 != 0) || year % 400 ==0;
82}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

52function isLeapYear(year) {
53 return (0 == year % 400)
54 || ((0 == year % 4) && (0 != year % 100))
55 || (0 == year);
56}
850function leapYear(year) {
851 year = year.getFullYear();
852 return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0);
853}
223function getLunarLeapYear(year){
224 var yearData = lunarInfo[year-minYear];
225 return yearData[0];
226};
33function isLeapYear(year) {
34 return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
35}
7export function isLeapYear(year: number): boolean {
8 return ((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)
9}
8isLeap (year) {
9 // calculation source: https://fa.wikipedia.org/wiki/%D8%B3%D8%A7%D9%84_%DA%A9%D8%A8%DB%8C%D8%B3%D9%87
10 const list = [
11 0,
12 4,
13 8,
14 12,
15 16,
16 20,
17 year > 473 ? 24 : 25,
18 29,
19 33,
20 37,
21 41,
22 45,
23 49,
24 53,
25 year > 473 ? 57 : 58,
26 62,
27 66,
28 70,
29 74,
30 78,
31 82,
32 86,
33 year > 473 ? 90 : 91,
34 95,
35 99,
36 103,
37 107,
38 111,
39 115,
40 year > 473 ? 119 : 120,
41 124
42 ]
43 return list.includes(year % 128)
44}
73export function getIsLeapYear () {
74 return isLeapYear(this.year());
75}
67isLeapYear(year: number): boolean {
68 return ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0);
69}
864function IsLeapYear (year) {
865 throw new Error('Not implemented');
866}

Related snippets