@dpc-sdp/ripple-global
Advanced tools
Comparing version 1.0.0-alpha.17 to 1.0.0-alpha.18
@@ -5,3 +5,4 @@ import moment from 'moment' | ||
props: { | ||
locale: { default: 'en-au', type: String } | ||
locale: { default: 'en-au', type: String }, | ||
rangeDivider: { default: ' to ', type: String } | ||
}, | ||
@@ -13,2 +14,18 @@ methods: { | ||
return moment(date).format(format) | ||
}, | ||
formatDateRange: function (dateStart, dateEnd) { | ||
moment.locale(this.locale) | ||
let rtn = '' | ||
const start = moment(dateStart) | ||
const end = moment(dateEnd) | ||
if (start.isSame(end, 'day')) { | ||
rtn = this.formatDate(start) | ||
} else if (start.isSame(end, 'month')) { | ||
rtn = `${start.format('DD')}${this.rangeDivider}${end.format('DD MMMM')}` | ||
} else if (start.isSame(end, 'year')) { | ||
rtn = `${start.format('DD MMMM')}${this.rangeDivider}${end.format('DD MMMM')}` | ||
} else { | ||
rtn = `${start.format('DD MMMM YYYY')}${this.rangeDivider}${end.format('DD MMMM YYYY')}` | ||
} | ||
return rtn | ||
} | ||
@@ -15,0 +32,0 @@ } |
{ | ||
"name": "@dpc-sdp/ripple-global", | ||
"version": "1.0.0-alpha.17", | ||
"version": "1.0.0-alpha.18", | ||
"description": "The core styles and utilities used by all ripple components. Includes sets of colours, fonts, breakpoints.", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
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
1532811
399