wix-design-systems-locale-utils
Advanced tools
Comparing version 1.72.0 to 1.73.0
@@ -5,11 +5,6 @@ "use strict"; | ||
exports.dateTimeFormat = void 0; | ||
var _getMediumDate = require("./getMediumDate/getMediumDate"); | ||
var _getLongTime = require("./getLongTime/getLongTime"); | ||
var _getShortDate = require("./getShortDate/getShortDate"); | ||
var _getShortTime = require("./getShortTime/getShortTime"); | ||
const dateTimeFormat = { | ||
@@ -16,0 +11,0 @@ getShortDate: _getShortDate.getShortDate, |
@@ -11,6 +11,8 @@ "use strict"; | ||
const modifiedLongTimes = { | ||
tr: date => new Intl.DateTimeFormat('tr', { ...longTimeOptions, | ||
tr: date => new Intl.DateTimeFormat('tr', { | ||
...longTimeOptions, | ||
hour12: true | ||
}).format(date) | ||
}; | ||
/** | ||
@@ -21,14 +23,10 @@ * Function that returns long time format approved by Wix Localization team. | ||
*/ | ||
const getLongTime = (locale, date) => { | ||
if (modifiedLongTimes[locale]) { | ||
var _modifiedLongTimes$lo; | ||
return (_modifiedLongTimes$lo = modifiedLongTimes[locale]) == null ? void 0 : _modifiedLongTimes$lo.call(modifiedLongTimes, date); | ||
} | ||
return new Intl.DateTimeFormat(locale, longTimeOptions).format(date); | ||
}; | ||
exports.getLongTime = getLongTime; | ||
//# sourceMappingURL=getLongTime.js.map |
"use strict"; | ||
var _getLongTime = require("./getLongTime"); | ||
describe('getLongTime', () => { | ||
@@ -6,0 +5,0 @@ it('to return long time generated by Intl', async () => { |
@@ -5,3 +5,2 @@ "use strict"; | ||
exports.getMediumDate = void 0; | ||
/** | ||
@@ -17,4 +16,3 @@ * Function that returns medium date format approved by Wix Localization team. | ||
}; | ||
exports.getMediumDate = getMediumDate; | ||
//# sourceMappingURL=getMediumDate.js.map |
"use strict"; | ||
var _getMediumDate = require("./getMediumDate"); | ||
describe('getMediumDate', () => { | ||
@@ -6,0 +5,0 @@ it('to return medium date', async () => { |
@@ -5,10 +5,9 @@ "use strict"; | ||
exports.getShortDate = void 0; | ||
const splitDate = (locale, date, format = {}) => { | ||
const _format$year = format.year, | ||
year = _format$year === void 0 ? 'numeric' : _format$year, | ||
_format$month = format.month, | ||
month = _format$month === void 0 ? 'numeric' : _format$month, | ||
_format$day = format.day, | ||
day = _format$day === void 0 ? 'numeric' : _format$day; | ||
year = _format$year === void 0 ? 'numeric' : _format$year, | ||
_format$month = format.month, | ||
month = _format$month === void 0 ? 'numeric' : _format$month, | ||
_format$day = format.day, | ||
day = _format$day === void 0 ? 'numeric' : _format$day; | ||
return { | ||
@@ -26,10 +25,8 @@ year: new Intl.DateTimeFormat(locale, { | ||
}; | ||
const modifiedShortDates = { | ||
fi: date => { | ||
const _splitDate = splitDate('fi', date), | ||
day = _splitDate.day, | ||
month = _splitDate.month, | ||
year = _splitDate.year; | ||
day = _splitDate.day, | ||
month = _splitDate.month, | ||
year = _splitDate.year; | ||
return `${day}.${month}.${year}`; | ||
@@ -39,9 +36,8 @@ }, | ||
const _splitDate2 = splitDate('ko', date, { | ||
month: '2-digit', | ||
day: '2-digit' | ||
}), | ||
day = _splitDate2.day, | ||
month = _splitDate2.month, | ||
year = _splitDate2.year; | ||
month: '2-digit', | ||
day: '2-digit' | ||
}), | ||
day = _splitDate2.day, | ||
month = _splitDate2.month, | ||
year = _splitDate2.year; | ||
return `${year}.${month}.${day}`.replace(/년|월|일/g, ''); | ||
@@ -53,6 +49,5 @@ }, | ||
const _splitDate3 = splitDate('es-US', date), | ||
day = _splitDate3.day, | ||
month = _splitDate3.month, | ||
year = _splitDate3.year; | ||
day = _splitDate3.day, | ||
month = _splitDate3.month, | ||
year = _splitDate3.year; | ||
return `${month}/${day}/${year}`; | ||
@@ -62,9 +57,9 @@ }, | ||
const _splitDate4 = splitDate('sv', date), | ||
day = _splitDate4.day, | ||
month = _splitDate4.month, | ||
year = _splitDate4.year; | ||
day = _splitDate4.day, | ||
month = _splitDate4.month, | ||
year = _splitDate4.year; | ||
return `${day}/${month} ${year}`; | ||
} | ||
}; | ||
/** | ||
@@ -75,10 +70,7 @@ * Function that returns short date format approved by Wix Localization team. | ||
*/ | ||
const getShortDate = (locale, date) => { | ||
if (modifiedShortDates[locale]) { | ||
var _modifiedShortDates$l; | ||
return (_modifiedShortDates$l = modifiedShortDates[locale]) == null ? void 0 : _modifiedShortDates$l.call(modifiedShortDates, date); | ||
} | ||
return new Intl.DateTimeFormat(locale, { | ||
@@ -90,4 +82,3 @@ day: '2-digit', | ||
}; | ||
exports.getShortDate = getShortDate; | ||
//# sourceMappingURL=getShortDate.js.map |
"use strict"; | ||
var _getShortDate = require("./getShortDate"); | ||
describe('getShortDate', () => { | ||
@@ -6,0 +5,0 @@ it('to return short date generated by Intl', async () => { |
@@ -16,2 +16,3 @@ "use strict"; | ||
}; | ||
/** | ||
@@ -22,14 +23,10 @@ * Function that returns short time format approved by Wix Localization team. | ||
*/ | ||
const getShortTime = (locale, date) => { | ||
if (modifiedShortTimes[locale]) { | ||
var _modifiedShortTimes$l; | ||
return (_modifiedShortTimes$l = modifiedShortTimes[locale]) == null ? void 0 : _modifiedShortTimes$l.call(modifiedShortTimes, date); | ||
} | ||
return new Intl.DateTimeFormat(locale, shortTimeOptions).format(date); | ||
}; | ||
exports.getShortTime = getShortTime; | ||
//# sourceMappingURL=getShortTime.js.map |
"use strict"; | ||
var _getShortTime = require("./getShortTime"); | ||
describe('getShortTime', () => { | ||
@@ -6,0 +5,0 @@ it('to return short time generated by Intl', async () => { |
@@ -5,10 +5,6 @@ "use strict"; | ||
exports.supportedWixlocales = exports.dateTimeFormat = void 0; | ||
var _dateTimeFormat = require("./dateTimeFormat"); | ||
exports.dateTimeFormat = _dateTimeFormat.dateTimeFormat; | ||
var _constants = require("./constants"); | ||
exports.supportedWixlocales = _constants.supportedWixlocales; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
exports.__esModule = true; | ||
var _dateTimeFormat = require("./dateTimeFormat"); | ||
Object.keys(_dateTimeFormat).forEach(function (key) { | ||
@@ -8,0 +6,0 @@ if (key === "default" || key === "__esModule") return; |
{ | ||
"name": "wix-design-systems-locale-utils", | ||
"version": "1.72.0", | ||
"version": "1.73.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -24,5 +24,5 @@ "module": "dist/esm/index.js", | ||
"@types/node": "^14.18.33", | ||
"@wix/eslint-config-yoshi": "^5.162.12", | ||
"@wix/jest-yoshi-preset": "^5.162.12", | ||
"@wix/yoshi-flow-library": "^5.162.12", | ||
"@wix/eslint-config-yoshi": "^5.162.13", | ||
"@wix/jest-yoshi-preset": "^5.162.13", | ||
"@wix/yoshi-flow-library": "^5.162.13", | ||
"express": "^4.18.2", | ||
@@ -46,3 +46,3 @@ "husky": "~4.3.8", | ||
}, | ||
"falconPackageHash": "22febd81e32af33b73b679179310e8871808a58db5add7b80ecc2c6b" | ||
"falconPackageHash": "6160d1ac12853a07a79b699ad6318bf872a85afc754d7f35e67047cb" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
555
111916