@wordpress/date
Advanced tools
Comparing version 4.2.2 to 4.2.3
@@ -351,3 +351,4 @@ /** | ||
export function format(dateFormat, dateValue = new Date()) { | ||
export function format(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
let i, char; | ||
@@ -405,3 +406,5 @@ const newFormat = []; | ||
export function date(dateFormat, dateValue = new Date(), timezone) { | ||
export function date(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
let timezone = arguments.length > 2 ? arguments[2] : undefined; | ||
const dateMoment = buildMoment(dateValue, timezone); | ||
@@ -421,3 +424,4 @@ return format(dateFormat, dateMoment); | ||
export function gmdate(dateFormat, dateValue = new Date()) { | ||
export function gmdate(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
const dateMoment = momentLib(dateValue).utc(); | ||
@@ -448,3 +452,6 @@ return format(dateFormat, dateMoment); | ||
export function dateI18n(dateFormat, dateValue = new Date(), timezone) { | ||
export function dateI18n(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
let timezone = arguments.length > 2 ? arguments[2] : undefined; | ||
if (true === timezone) { | ||
@@ -474,3 +481,4 @@ return gmdateI18n(dateFormat, dateValue); | ||
export function gmdateI18n(dateFormat, dateValue = new Date()) { | ||
export function gmdateI18n(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
const dateMoment = momentLib(dateValue).utc(); | ||
@@ -523,3 +531,4 @@ dateMoment.locale(settings.l10n.locale); | ||
function buildMoment(dateValue, timezone = '') { | ||
function buildMoment(dateValue) { | ||
let timezone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
const dateMoment = momentLib(dateValue); | ||
@@ -526,0 +535,0 @@ |
@@ -8,11 +8,11 @@ "use strict"; | ||
}); | ||
exports.setSettings = setSettings; | ||
exports.__experimentalGetSettings = __experimentalGetSettings; | ||
exports.date = date; | ||
exports.dateI18n = dateI18n; | ||
exports.format = format; | ||
exports.date = date; | ||
exports.getDate = getDate; | ||
exports.gmdate = gmdate; | ||
exports.dateI18n = dateI18n; | ||
exports.gmdateI18n = gmdateI18n; | ||
exports.isInTheFuture = isInTheFuture; | ||
exports.getDate = getDate; | ||
exports.setSettings = setSettings; | ||
@@ -376,3 +376,4 @@ var _moment = _interopRequireDefault(require("moment")); | ||
function format(dateFormat, dateValue = new Date()) { | ||
function format(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
let i, char; | ||
@@ -431,3 +432,5 @@ const newFormat = []; | ||
function date(dateFormat, dateValue = new Date(), timezone) { | ||
function date(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
let timezone = arguments.length > 2 ? arguments[2] : undefined; | ||
const dateMoment = buildMoment(dateValue, timezone); | ||
@@ -448,3 +451,4 @@ return format(dateFormat, dateMoment); | ||
function gmdate(dateFormat, dateValue = new Date()) { | ||
function gmdate(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
const dateMoment = (0, _moment.default)(dateValue).utc(); | ||
@@ -476,3 +480,6 @@ return format(dateFormat, dateMoment); | ||
function dateI18n(dateFormat, dateValue = new Date(), timezone) { | ||
function dateI18n(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
let timezone = arguments.length > 2 ? arguments[2] : undefined; | ||
if (true === timezone) { | ||
@@ -503,3 +510,4 @@ return gmdateI18n(dateFormat, dateValue); | ||
function gmdateI18n(dateFormat, dateValue = new Date()) { | ||
function gmdateI18n(dateFormat) { | ||
let dateValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date(); | ||
const dateMoment = (0, _moment.default)(dateValue).utc(); | ||
@@ -557,3 +565,4 @@ dateMoment.locale(settings.l10n.locale); | ||
function buildMoment(dateValue, timezone = '') { | ||
function buildMoment(dateValue) { | ||
let timezone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
const dateMoment = (0, _moment.default)(dateValue); | ||
@@ -560,0 +569,0 @@ |
{ | ||
"name": "@wordpress/date", | ||
"version": "4.2.2", | ||
"version": "4.2.3", | ||
"description": "Date module for WordPress.", | ||
@@ -29,3 +29,3 @@ "author": "The WordPress Contributors", | ||
"dependencies": { | ||
"@babel/runtime": "^7.13.10", | ||
"@babel/runtime": "^7.16.0", | ||
"moment": "^2.22.1", | ||
@@ -37,3 +37,3 @@ "moment-timezone": "^0.5.31" | ||
}, | ||
"gitHead": "8f7f052bc04e3f4eb50f479ced14be1489b9fa79" | ||
"gitHead": "9a1dd3474d937468e4cf9caf9886ad61ef0a8f50" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
178913
2172
Updated@babel/runtime@^7.16.0