Formify Docs

Longitude

Validate longitude coordinates in decimal degrees.

Longitude

Validates that a value is a longitude coordinate in decimal degrees, in the range -180 to 180.

Configuration

Config flagTypeDescription
longitudebooleanWhen true, requires the value to be a valid longitude.

With useForm

const form = useForm({
  initialValues: { lng: '' },
  validationSchema: {
    lng: { longitude: true },
  },
});

With the V builder

import { V } from 'formify-js';

V.longitude();

Default message

ScenarioMessage
Value is not a valid longitudeMust be a valid longitude

Examples

ValueResult
'-0.1278'✅ Valid
'139.6917'✅ Valid
'180'✅ Valid (antimeridian)
'-181'❌ Invalid (out of range)
'12.3E'❌ Invalid (direction suffix not accepted)

Notes

  • Values outside -180 … 180 fail.
  • Direction suffixes (E/W) and degree symbols are not accepted — use plain decimal degrees.
  • Combine with latitude to validate coordinate pairs on separate fields.

On this page