How to use the date-and-time.parse function in date-and-time

To help you get started, we’ve selected a few date-and-time examples, based on popular ways it is used in public projects.

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

github Wikiki / bulma-calendar / src / js / index.js View on Github external
set maxDate(date = undefined) {
    this.datePicker.maxDate = dateUtils.parse(date, this.dateFormat);
    return this;
  }
  // Get maxDate
github kpi-wdc / dj / wdc_libs / parsers / ch-ftp / aggregate.js View on Github external
var truncAndShiftDate = function(d,period){
		var vtp = valueTimePattern[period];
		return shift[period](date.parse(date.format(new Date(d),vtp),vtp))
	}
github ink-components / ink-components / src / InkSimple.js View on Github external
render() {
        let d = this.date;
        if(date.isValid(this.date, SERVER_DATE_FORMAT)){
            d = date.format(date.parse(this.date, SERVER_DATE_FORMAT), 'YYYY');
        }

        return html`
            <style>
                :host{
                    text-align: left;
                }
                .card{
                    display: inline-block;
                    width: ${ this.width || '230px'};
                    height: 0;
                    margin: 8px;
                    position: relative;
                    cursor: pointer;
                    text-decoration: none;
                }</style>
github kpi-wdc / dj / wdc_libs / parsers / ch-ftp / index.js View on Github external
return src.map(function(item){
											var t = item.DATE.toString() 
													+ ":"
													+ item.HOUR.toString()
													+":0";
											
											return {
												"#value":item.AVG,
												"indicator":indicators[id].label,
												"#indicator":id,
												"time": date.parse(t,"YYYYMMDD:H:m"),
												"#time": date.parse(t,"YYYYMMDD:H:m")
											}
										})
									}
github kpi-wdc / dj / dj-libs / bayes-simulator / index.js View on Github external
var getTimePointsFromIndicators = function(indicators, fromT, toT) {
	var timePointsSet = new Set();
	for(var varName in indicators) {
		var varIndicators = indicators[varName];
		for(var valueName in varIndicators) {
			var indicator = varIndicators[valueName];
			var sDate = date.parse(indicator.start.stamp,
					indicator.start.format);
			var eDate = date.parse(indicator.end.stamp,
					indicator.end.format)
			var fromDate = date.parse(fromT.stamp, fromT.format);
			var toDate = date.parse(toT.stamp, toT.format);
			var pDuration = indicator.period ? new Duration(indicator.period) : undefined;
			if (pDuration) {
				interval = findPeriodicalIntervalFor(fromDate, sDate, eDate, pDuration);
				var period = pDuration.milliseconds();
				if (!isInInterval(interval.sDate, fromDate, toDate) &&
					!isInInterval(interval.eDate, fromDate, toDate) ) {
					sDate = date.addMilliseconds(interval.sDate, period);
					eDate = date.addMilliseconds(interval.eDate, period);
				} else if (isInInterval(date.addMilliseconds(interval.eDate, -period), fromDate, toDate)) {
					sDate = date.addMilliseconds(interval.sDate, -period);
					eDate = date.addMilliseconds(interval.eDate, -period);
				} else {
					sDate = interval.sDate;
github Wikiki / bulma-calendar / src / js / index.js View on Github external
set startDate(date = undefined) {
    this.datePicker.start = dateUtils.parse(date, this.dateFormat);
    return this;
  }
  get startDate() {
github kpi-wdc / dj / dj-libs / bayes-simulator / index.js View on Github external
getEvidences: function(t) {
			var evidences = {};
			for(var varName in this.indicators) {
				evidences[varName] = {};
				var varIndicators = this.indicators[varName];
				for(var valueName in varIndicators) {
					var indicator = varIndicators[valueName];
					var sDate = date.parse(indicator.start.stamp,
							indicator.start.format);
					var eDate = date.parse(indicator.end.stamp,
							indicator.end.format)
					var tDate = date.parse(t.stamp, t.format);

					if (indicator.period) {
						interval = findPeriodicalIntervalFor(tDate, sDate, eDate, new Duration(indicator.period));
						sDate = interval.sDate;
						eDate = interval.eDate;
					}

					if (isInInterval(tDate, sDate, eDate)) {
						if (!indicator.distribution) {
							evidences[varName] = valueName;
							break;
						}
						var distr = indicator.distribution;
						for(var i=distr.length-1; i >=0; i--) {
							var fromStart = new Duration(distr[i].fromStart).milliseconds();
							var iDate = date.addMilliseconds(sDate, fromStart);
github kpi-wdc / dj / dj-libs / bayes-simulator / index.js View on Github external
getEvidences: function(t) {
			var evidences = {};
			for(var varName in this.indicators) {
				evidences[varName] = {};
				var varIndicators = this.indicators[varName];
				for(var valueName in varIndicators) {
					var indicator = varIndicators[valueName];
					var sDate = date.parse(indicator.start.stamp,
							indicator.start.format);
					var eDate = date.parse(indicator.end.stamp,
							indicator.end.format)
					var tDate = date.parse(t.stamp, t.format);

					if (indicator.period) {
						interval = findPeriodicalIntervalFor(tDate, sDate, eDate, new Duration(indicator.period));
						sDate = interval.sDate;
						eDate = interval.eDate;
					}

					if (isInInterval(tDate, sDate, eDate)) {
						if (!indicator.distribution) {
							evidences[varName] = valueName;
							break;
						}
						var distr = indicator.distribution;
						for(var i=distr.length-1; i >=0; i--) {
github kpi-wdc / dj / wdc_libs / parsers / ch-ftp / aggregate.js View on Github external
var truncDate = function(d,period){
		return date.parse(date.format(new Date(d),period),period)
	}
github Wikiki / bulma-calendar / src / js / index.js View on Github external
set endDate(date = undefined) {
    this.datePicker.end = dateUtils.parse(date, this.dateFormat);
    return this;
  }
  get endDate() {