How to use the fontoxpath/expressions/dataTypes/valueTypes/DateTime.fromString function in fontoxpath

To help you get started, we’ve selected a few fontoxpath 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 FontoXML / fontoxpath / test / specs / expressions / dataTypes / valueTypes / DateTime.tests.ts View on Github external
it('accepts "-2000-12-12T20:10:10.2" as input', () => {
			const dateTime = DateTime.fromString('2000-12-12T20:10:10.2');
			chai.assert.deepEqual(dateTime, new DateTime(2000, 12, 12, 20, 10, 10, 0.2, null));
		});
github FontoXML / fontoxpath / test / specs / expressions / dataTypes / valueTypes / DateTime.tests.ts View on Github external
it('accepts "2000-12-12T20:10:10.2+10:00" as input', () => {
			const dateTime = DateTime.fromString('2000-12-12T20:10:10.2+10:00');
			chai.assert.deepEqual(
				dateTime,
				new DateTime(
					2000,
					12,
					12,
					20,
					10,
					10,
					0.2,
					DayTimeDuration.fromTimezoneString('+10:00')
				)
			);
		});
	});
github FontoXML / fontoxpath / test / specs / expressions / dataTypes / castToType.tests.ts View on Github external
it('from xs:date', () =>
			chai.assert.deepEqual(
				castToType(
					createAtomicValue(DateTime.fromString('2000-10-10+10:30'), 'xs:date'),
					'xs:dateTime'
				),
				createAtomicValue(DateTime.fromString('2000-10-10T00:00:00+10:30'), 'xs:dateTime')
			));
		it('from xs:gYearMonth (throws XPTY0004)', () =>
github FontoXML / fontoxpath / test / specs / expressions / adaptJavaScriptValueToXPathValue.tests.ts View on Github external
it('turns date into xs:gYearMonth', () => {
		const xpathSequence = adaptJavaScriptValueToXPathValue(
			new Date(Date.UTC(2018, 5, 22, 9, 10, 20)),
			'xs:gYearMonth'
		);
		chai.assert(xpathSequence.isSingleton(), 'is a singleton sequence');
		chai.assert(xpathSequence.first().type === 'xs:gYearMonth', 'is a gYearMonth');
		chai.assert.deepEqual(
			xpathSequence.first().value,
			DateTime.fromString('2018-06Z'),
			'is June 2018'
		);
	});
github FontoXML / fontoxpath / test / specs / expressions / adaptJavaScriptValueToXPathValue.tests.ts View on Github external
it('turns date into xs:gDay', () => {
		const xpathSequence = adaptJavaScriptValueToXPathValue(
			new Date(Date.UTC(2018, 5, 22, 9, 10, 20)),
			'xs:gDay'
		);
		chai.assert(xpathSequence.isSingleton(), 'is a singleton sequence');
		chai.assert(xpathSequence.first().type === 'xs:gDay', 'is a gDay');
		chai.assert.deepEqual(
			xpathSequence.first().value,
			DateTime.fromString('---22Z'),
			'is 22nd'
		);
	});
github FontoXML / fontoxpath / test / specs / expressions / adaptJavaScriptValueToXPathValue.tests.ts View on Github external
it('turns date into xs:gMonthDay', () => {
		const xpathSequence = adaptJavaScriptValueToXPathValue(
			new Date(Date.UTC(2018, 5, 22, 9, 10, 20)),
			'xs:gMonthDay'
		);
		chai.assert(xpathSequence.isSingleton(), 'is a singleton sequence');
		chai.assert(xpathSequence.first().type === 'xs:gMonthDay', 'is a gMonthDay');
		chai.assert.deepEqual(
			xpathSequence.first().value,
			DateTime.fromString('-06-22Z'),
			'is 22nd June'
		);
	});
github FontoXML / fontoxpath / test / specs / expressions / dataTypes / valueTypes / DateTime.tests.js View on Github external
it('accepts "2000-12-12T20:10:10.2+10:00" as input', () => {
			const dateTime = DateTime.fromString('2000-12-12T20:10:10.2+10:00');
			chai.assert.deepEqual(dateTime, new DateTime(2000, 12, 12, 20, 10, 10, .2, DayTimeDuration.fromTimezoneString('+10:00')));
		});
	});
github FontoXML / fontoxpath / test / specs / expressions / dataTypes / castToType.tests.ts View on Github external
it('from xs:date', () =>
			chai.assert.deepEqual(
				castToType(
					createAtomicValue(DateTime.fromString('2000-10-10+10:30'), 'xs:date'),
					'xs:gYearMonth'
				),
				createAtomicValue(DateTime.fromString('2000-10+10:30'), 'xs:gYearMonth')
			));
		it('from xs:gYearMonth', () =>
github FontoXML / fontoxpath / test / specs / expressions / adaptJavaScriptValueToXPathValue.tests.ts View on Github external
it('turns date into xs:time', () => {
		const xpathSequence = adaptJavaScriptValueToXPathValue(
			new Date(Date.UTC(2018, 5, 22, 9, 10, 20)),
			'xs:time'
		);
		chai.assert(xpathSequence.isSingleton(), 'is a singleton sequence');
		chai.assert(xpathSequence.first().type === 'xs:time', 'is a time');
		chai.assert.deepEqual(
			xpathSequence.first().value,
			DateTime.fromString('09:10:20Z'),
			'is 09:10:20'
		);
	});
github FontoXML / fontoxpath / test / specs / expressions / dataTypes / castToType.tests.ts View on Github external
() =>
					castToType(
						createAtomicValue(DateTime.fromString('2000+10:30'), 'xs:gYear'),
						'xs:anyURI'
					),
				'XPTY0004'