8 examples of 'get current year javascript' in JavaScript

Every line of 'get current year javascript' 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
96public getCurrentDate(): string {
97 /* Return current year(string) to display in calendar header. */
98 return this.state.date.year().toString();
99}
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

66private getStartingYear(year:number) {
67 // todo: parseInt
68 return ((year - 1) / this.datePicker.yearRange) * this.datePicker.yearRange + 1;
69}
34protected getYear(year: number): KeyValue {
35 const date = addYears(this.pageStart, year);
36
37 const classes = [];
38 if (year === 0 || year === 11) {
39 classes.push("date-other");
40 }
41 if (this.config) {
42 if (isDate(this.config.date) && isSameYear(date, this.config.date)) {
43 classes.push("selected");
44 }
45
46 if (isDisabled({ disabled: [], ...this.config }, date)) {
47 classes.push("disabled");
48 }
49 }
50
51 return { date, label: format(date, "yyyy"), classes: classes.join(" ") };
52}
73getSelectedYear() {
74 return $(this.rootElement)
75 .$('select')
76 .getValue();
77}
54function onChangeYear() {
55 date.setFullYear($(this).val());
56 update();
57}
129public getCurrentYear() {
130 return new Date().getFullYear();
131}
36get year(): number {
37 return getYear(this.fakeValue);
38}
7showCurrentYear() {
8 return new Date().getFullYear();
9}

Related snippets