@ledvance/base 1.2.27 → 1.2.28

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.
@@ -173,4 +173,14 @@ export function mapFloatToRange(value: number, min: number, max: number): number
173
173
 
174
174
  export function mapValueToRatio(value: number, min: number, max: number): number {
175
175
  return ((value || 0) - min) / (max - min)
176
+ }
177
+
178
+ export function abbreviateMonths(str: string) {
179
+ const monthAbbreviations = {
180
+ January: 'Jan', February: 'Feb', March: 'Mar', April: 'Apr',
181
+ May: 'May', June: 'Jun', July: 'Jul', August: 'Aug',
182
+ September: 'Sep', October: 'Oct', November: 'Nov', December: 'Dec'
183
+ };
184
+
185
+ return str.replace(/(?:January|February|March|April|May|June|July|August|September|October|November|December)/g, match => monthAbbreviations[match]);
176
186
  }