A calendar or, more generally, a time measurement system, can be based on anything. While human calendars have (generally) been based on:
* Day = One cycle of the Earth's rotation
* Month = One cycle of the moon's revolution around the Earth
* Year = One cycle of the Earth's revolution around the sun
those are not universal (e.g., some calendars use 12 lunar months and "slide" ~ 11 days per year; most use months that are longer (except February) than lunar months; etc.).
As with most other measurements (length, weight, etc.) the calendar has been redefined to be based on physical principles that are independent of the Earth, sun and moon. [The second is defined as](https://en.wikipedia.org/wiki/Second):
> the time duration of 9,192,631,770 periods of the radiation corresponding to the transition between the two hyperfine levels of the fundamental unperturbed ground-state of the caesium-133 atom.
and everything else flows from there - e.g., 86,400 seconds in day, 365 days in a standard year, etc.
In practice, due to the affected population all (except ISS, and they're orbiting Earth) residing on Earth and the physical aspects of the solar system therefore still relevant, there is an adjustment system of leap seconds to keep our calendar synchronized with the solar system (or at least with the sun). But it is all arbitrary. A Mars colony might choose to make a calendar based on the average local day and year, but they would likely have to coordinate with an Earth-centric calendar as well. Long-term deep space missions might stick with an Earth-centric calendar even though the original basis - Earth, moon, sun - would not be relevant at all. In the end - [it is all just math](https://xkcd.com/435/).