@jamesrock/rockjs 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export const limit = (value, max) => value > max ? max : value;
|
|
|
20
20
|
export const formatTime = (t) => `${pad(formatMinutes(t))}:${pad(formatSeconds(t))}`;
|
|
21
21
|
export const formatNumber = (n) => formatter.format(n);
|
|
22
22
|
export const formatCurrency = (n) => currencyFormatter.format(n);
|
|
23
|
+
export const formatDate = (date, type = 'short') => date.toLocaleDateString('en-GB', { dateStyle: type });
|
|
23
24
|
export const getDateString = (type = 'short') => new Date().toLocaleDateString('en-GB', { dateStyle: type });
|
|
24
25
|
export const getTimeString = (type = 'short') => new Date().toLocaleTimeString('en-GB', { timeStyle: type });
|
|
25
26
|
export const getDateTimeString = (type = 'short') => `${getDateString(type)} ${getTimeString(type)}`;
|