How to use the ilib/DateFmt function in ilib

To help you get started, we’ve selected a few ilib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enactjs / enact / packages / moonstone / TimePicker / TimePickerController.js View on Github external
type: 'time',
				useNative: false,
				timezone: 'local',
				length: 'full',
				date: 'dmwy'
			};

			this.timeFormat = new DateFmt(format);

			const meridiemFormat = {
				template: 'a',
				useNative: false,
				timezone: 'local'
			};

			const merFormatter = new DateFmt(meridiemFormat);
			const meridiems = merFormatter.getMeridiemsRange(meridiemFormat);
			this.meridiemRanges = meridiems.map(calcMeridiemRange);
			this.meridiemLabels = meridiems.map(obj => obj.name);

			// Set picker format 12 vs 24 hour clock
			const li = new LocaleInfo();
			const clockPref = li.getClock();
			this.meridiemEnabled = clockPref === '12';

			const filter = this.meridiemEnabled ? includeMeridiem : excludeMeridiem;
			this.order = this.timeFormat.getTemplate().match(filter).map(s => s[0].toLowerCase());

			const timeFormat = {
				type: 'time',
				time: 'h',
				useNative: false,
github enactjs / enact / packages / moonstone / TimePicker / TimePickerController.js View on Github external
initI18n () {
		const locale = ilib.getLocale();

		if (this.locale !== locale && typeof window === 'object') {
			this.locale = locale;

			const format = {
				type: 'time',
				useNative: false,
				timezone: 'local',
				length: 'full',
				date: 'dmwy'
			};

			this.timeFormat = new DateFmt(format);

			const meridiemFormat = {
				template: 'a',
				useNative: false,
				timezone: 'local'
			};

			const merFormatter = new DateFmt(meridiemFormat);
			const meridiems = merFormatter.getMeridiemsRange(meridiemFormat);
			this.meridiemRanges = meridiems.map(calcMeridiemRange);
			this.meridiemLabels = meridiems.map(obj => obj.name);

			// Set picker format 12 vs 24 hour clock
			const li = new LocaleInfo();
			const clockPref = li.getClock();
			this.meridiemEnabled = clockPref === '12';
github enactjs / enact / packages / moonstone / TimePicker / TimePickerController.js View on Github external
const timeFormat = {
				type: 'time',
				time: 'h',
				useNative: false,
				timezone: 'local'
			};

			if (clockPref !== 'locale') {
				timeFormat.clock = clockPref;
			}

			this.hourFormatter = new DateFmt(timeFormat);

			timeFormat.time = 'm';
			this.minuteFormatter = new DateFmt(timeFormat);
		}
	}
github enactjs / enact / packages / moonstone / TimePicker / TimePickerController.js View on Github external
const filter = this.meridiemEnabled ? includeMeridiem : excludeMeridiem;
			this.order = this.timeFormat.getTemplate().match(filter).map(s => s[0].toLowerCase());

			const timeFormat = {
				type: 'time',
				time: 'h',
				useNative: false,
				timezone: 'local'
			};

			if (clockPref !== 'locale') {
				timeFormat.clock = clockPref;
			}

			this.hourFormatter = new DateFmt(timeFormat);

			timeFormat.time = 'm';
			this.minuteFormatter = new DateFmt(timeFormat);
		}
	}
github enactjs / enact / packages / moonstone / DatePicker / DatePickerController.js View on Github external
initI18n () {
		const locale = ilib.getLocale();

		if (this.locale !== locale && typeof window === 'object') {
			this.locale = locale;

			this.dateFormat = new DateFmt({
				date: 'dmwy',
				length: 'full',
				timezone: 'local',
				useNative: false
			});

			this.order = this.dateFormat.getTemplate().match(/([mdy]+)/ig).map(s => s[0].toLowerCase());
		}
	}