10 examples of 'jquery get date' in JavaScript

Every line of 'jquery get date' 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
65function getDateObj(myDate: any): Date | null {
66 if (myDate == null) {
67 return null;
68 }
69
70 if (myDate instanceof String || typeof myDate === 'string') {
71 return new Date('' + myDate);
72 }
73
74 // A Firebase Timestamp format
75 if (myDate && (myDate.seconds >= 0 || myDate.seconds < 0) && (myDate.nanoseconds >= 0 || myDate.nanoseconds < 0)) {
76 return new Date(myDate.toDate());
77 }
78
79 return myDate;
80}
66function getCurrentDate() {
67 date = $("#date-picker").val();
68 time = $("#spinner").val();
69 millis = Date.parse(date + " " + time + " GMT");
70 return new Date(millis)
71}
83_getDate(date, minDate = this.state.minDate, maxDate = this.state.maxDate) {
84 // If no date is provided then use current date
85 // Make sure we constrain it to the min and max
86 const current = (date instanceof Date) ? date : new Date();
87
88 if (minDate && current < minDate) {
89 return minDate;
90 }
91
92 if (maxDate && current > maxDate) {
93 return maxDate;
94 }
95
96 return current;
97}
37function getDate(strDate) {
38 /* istanbul ignore next */
39 return moment(strDate).format('YYYY-MM-DD')
40}
649function getDate () {
650 return ref.toDate();
651}
49function getDateTime(elem) {
50 var now = new Date();
51 var now_msec = now.getTime();
52 return new Date(now_msec + elem.data('serverDiff') + 3600000 * Number(elem.data('offset')));
53
54}
46function parseDate(str) {
47 if (Y.Lang.isNull(str) || Y.Lang.isUndefined(str))
48 return null;
49 var parts = str.split(/[- :]/);
50 if ( parts.length < 3 )
51 return null;
52 while ( parts.length < 6 )
53 parts.push(0);
54 return new Date(parts[0], parts[1]-1, parts[2], parts[3], parts[4], parts[5]);
55}
6export function getDate(value) {
7 return isDate(value) ? value : new Date(value)
8}
269function getElemDate(elem) { return calendarBody.dateCellDates[$(elem).closest('[date-cell-index]').attr('date-cell-index')] }
8function getDateObject(datetime) {
9 var t = datetime instanceof Date ? datetime : new Date(datetime);
10 if (!t.getDate()) {
11 t = new Date();
12 }
13 return t;
14}

Related snippets