MCPcopy Index your code
hub / github.com/parse-community/parse-server / parseDate

Function parseDate

spec/ParseQuery.spec.js:539–561  ·  view source on GitHub ↗
(iso8601)

Source from the content-addressed store, hash-verified

537 const DateSet = Parse.Object.extend({ className: 'DateSet' });
538
539 function parseDate(iso8601) {
540 const regexp = new RegExp(
541 '^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2})' +
542 'T' +
543 '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})' +
544 '(.([0-9]+))?' +
545 'Z$'
546 );
547 const match = regexp.exec(iso8601);
548 if (!match) {
549 return null;
550 }
551
552 const year = match[1] || 0;
553 const month = (match[2] || 1) - 1;
554 const day = match[3] || 0;
555 const hour = match[4] || 0;
556 const minute = match[5] || 0;
557 const second = match[6] || 0;
558 const milli = match[8] || 0;
559
560 return new Date(Date.UTC(year, month, day, hour, minute, second, milli));
561 }
562
563 const makeDates = function (stringArray) {
564 return stringArray.map(function (dateStr) {

Callers 1

makeDatesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected