Sha256: 9dde544576a4c552c56ee5f102459d4e3ca28bb800ccba833b53bd159d1e864a

Contents?: true

Size: 1.03 KB

Versions: 174

Compression:

Stored size: 1.03 KB

Contents

'use strict';

var GetIntrinsic = require('get-intrinsic');

var $TypeError = GetIntrinsic('%TypeError%');

var weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

var $isNaN = require('../helpers/isNaN');
var padTimeComponent = require('../helpers/padTimeComponent');

var Type = require('./Type');
var WeekDay = require('./WeekDay');
var MonthFromTime = require('./MonthFromTime');
var YearFromTime = require('./YearFromTime');
var DateFromTime = require('./DateFromTime');

// https://262.ecma-international.org/9.0/#sec-datestring

module.exports = function DateString(tv) {
	if (Type(tv) !== 'Number' || $isNaN(tv)) {
		throw new $TypeError('Assertion failed: `tv` must be a non-NaN Number');
	}
	var weekday = weekdays[WeekDay(tv)];
	var month = months[MonthFromTime(tv)];
	var day = padTimeComponent(DateFromTime(tv));
	var year = padTimeComponent(YearFromTime(tv), 4);
	return weekday + '\x20' + month + '\x20' + day + '\x20' + year;
};

Version data entries

174 entries across 30 versions & 4 rubygems

Version Path
immosquare-cleaner-0.1.32 node_modules/es-abstract/2022/DateString.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2019/DateString.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2021/DateString.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2018/DateString.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2020/DateString.js
immosquare-cleaner-0.1.32 node_modules/es-abstract/2023/DateString.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2023/DateString.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2018/DateString.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2020/DateString.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2021/DateString.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2019/DateString.js
immosquare-cleaner-0.1.31 node_modules/es-abstract/2022/DateString.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2022/DateString.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2023/DateString.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2018/DateString.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2019/DateString.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2021/DateString.js
immosquare-cleaner-0.1.30 node_modules/es-abstract/2020/DateString.js
immosquare-cleaner-0.1.29 node_modules/es-abstract/2018/DateString.js
immosquare-cleaner-0.1.29 node_modules/es-abstract/2021/DateString.js