Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@filerobot/utils / lib / getDateString.js
Size: Mime:
/**
 * Returns a date in the all formats
 */

export default function getDateString(format, spaceType, timeStamp) {
  var dateObject = timeStamp ? new Date(timeStamp) : new Date();
  var getMonth = dateObject.getMonth() + 1;
  var getDay = dateObject.getDate();
  var month = getMonth < 10 ? '0' + getMonth : getMonth;
  var day = getDay < 10 ? '0' + getDay : getDay;
  var year = dateObject.getFullYear();
  switch (format) {
    case 'mdy':
      return month + spaceType + day + spaceType + year;
    case 'dmy':
      return day + spaceType + month + spaceType + year;
    case 'ymd':
      return year + spaceType + month + spaceType + day;
  }
}