How to use the fecha.parse function in fecha

To help you get started, we’ve selected a few fecha 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 knacksteem / knacksteem.org / src / containers / Profile / index.js View on Github external
remoteUserObject,
      rewardFundObject,
      dynamicGlobalPropertiesObject,
      currentMedianHistoryPriceObject
    ]);


    const activeCategory = queryString.parse(this.props.location.search).category;
    const articlesList = typeof activeCategory !== 'undefined' ?
      articles.data.filter(article => article.category === activeCategory) : 
      articles.data;

    // If we've loaded all core objects...
    if (hasLoadedRemoteUserObject) {
      signupDate = fecha.format(
        fecha.parse(
          remoteUserObject.created.split('T')[0],
          'YYYY-MM-DD'
        ),
        'D MMMM YYYY'
      );

      if (typeof remoteUserObject === 'object'
      && Object.keys(remoteUserObject).length > 0) {
         console.log();
        if(remoteUserObject.json_metadata !== '' && Object.keys(JSON.parse(remoteUserObject.json_metadata)).length > 0 ){
          remoteUserObjectMeta = JSON.parse(remoteUserObject.json_metadata).profile
          coverImage = remoteUserObjectMeta.cover_image;
        }
        name = remoteUserObject.name;
        displayName = name && name !== '' ? name : uppercaseFirst(match.params.username);
        reputation = repLog10(parseFloat(remoteUserObject.reputation));
github amazeui / amazeui-react / src / DateTimePicker / DatePicker.js View on Github external
var selectedDate = this.props.selectedDate;

    var currentDate = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), selectedDate.getDate(), 0, 0, 0, 0).valueOf();

    var prevMonth = new Date(year, month - 1, 28, 0, 0, 0, 0);
    var day = dateUtils.getDaysInMonth(prevMonth.getFullYear(), prevMonth.getMonth());

    prevMonth.setDate(day);
    prevMonth.setDate(day - (prevMonth.getDay() - weekStart + 7) % 7);

    var nextMonth = new Date(prevMonth);

    nextMonth.setDate(nextMonth.getDate() + 42);
    nextMonth = nextMonth.valueOf();

    var minDate = this.props.minDate && fecha.parse(this.props.minDate, this.props.format);
    var maxDate = this.props.maxDate && fecha.parse(this.props.maxDate, this.props.format);

    while (prevMonth.valueOf() < nextMonth) {
      classes[this.prefixClass('day')] = true;

      prevY = prevMonth.getFullYear();
      prevM = prevMonth.getMonth();


      // set className old new
      if ((prevM < month && prevY === year) || prevY < year) {
        classes[this.prefixClass('old')] = true;
      } else if ((prevM > month && prevY === year) || prevY > year) {
        classes[this.prefixClass('new')] = true;
      }
github krystalcampioni / vue-hotel-datepicker / src / vendor / hotel-datepicker.js View on Github external
parseDate(date, format = this.format) {
        // Parse a date object
        return fecha.parse(date, format);
    }
github vue-generators / vue-form-generator / src / utils / dateFieldHelper.js View on Github external
formatValueToField(value) {
		if (value != null) {
			let dt = this.schema.format ? fecha.parse(value, this.schema.format) : new Date(value);
			return fecha.format(dt, this.getDateFormat());
		}

		return value;
	},
github webiny / webiny-js / packages / webiny-i18n / src / I18n.js View on Github external
dateTime(
        value: Date | string | number,
        outputFormat: ?string = null,
        inputFormat: string = "YYYY-MM-DDTHH:mm:ss.SSSZ"
    ): string {
        if (!outputFormat) {
            outputFormat = this.getDateTimeFormat();
        }

        if (!(value instanceof Date)) {
            value = fecha.parse(value, inputFormat);
        }

        return fecha.format(value, outputFormat);
    }
github webiny / webiny-js / packages-utils / webiny-i18n / src / index.js View on Github external
date(
        value: Date | string | number,
        outputFormat: ?string = null,
        inputFormat: string = "Y-m-dTH:i:sO"
    ): string {
        if (!outputFormat) {
            outputFormat = this.getDateFormat();
        }

        if (!(value instanceof Date)) {
            value = fecha.parse(value, inputFormat);
        }

        return fecha.format(value, outputFormat);
    }
github vue-generators / vue-form-generator / src / fields / core / fieldInput.vue View on Github external
formatDatetimeToModel(newValue, oldValue) {
			let defaultFormat = DATETIME_FORMATS[this.schema.inputType.toLowerCase()];
			let m = fecha.parse(newValue, defaultFormat);
			if (m !== false) {
				if (this.schema.format) {
					newValue = fecha.format(m, this.schema.format);
				} else {
					newValue = m.valueOf();
				}
			}
			this.updateModelValue(newValue, oldValue);
		},
		formatDatetimeValueToField(value) {
github celo-org / celo-monorepo / packages / web / src / shared / PlaceDate.tsx View on Github external
export function parseDate(date: string | undefined) {
  if (date) {
    return fecha.parse(date, 'MM-DD-YY')
  }
  return null
}
github netresearch / assetpicker / src / js / app / adapter / base.js View on Github external
parseDate: function (date) {
            if (date) {
                return fecha.parse(date, this.$options.dateFormat);
            }
        },
        createItem: function (data) {
github holo-rea / holo-rea-proto / src / graphql-adapter / src / types / index.ts View on Github external
const parseDate = (val: string) => fecha.parse(val, 'YYYY-MM-DDTHH:mm:ssZZ')

fecha

Date formatting and parsing

MIT
Latest version published 2 years ago

Package Health Score

76 / 100
Full package analysis