all files / addon/helpers/ date-short-lllz.js

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30                                                   
import { helper as buildHelper } from '@ember/component/helper';
import formatUtil from '../utils/format-util';
 
 
/**
 * The formatting options for the default Locale.
 * @type {{hour: string, minute: string}}
 */
const defaultOptions = {
  day: 'numeric',
  hour: 'numeric',
  minute: 'numeric',
  month: 'short',
  timeZoneName: 'short',
  year: 'numeric'
};
 
/**
 * Instantiate a basic NumberFormat in the browser's locale that will be used for basic formatting.
 * @type {Intl.NumberFormat}
 */
const formatter = new Intl.DateTimeFormat(undefined, defaultOptions);
 
export function dateShortLllz([date], options) {
  return formatUtil(formatter, defaultOptions, date, options);
}
 
export default buildHelper(dateShortLllz);