Module:TwitterSnowflake/doc

From Zoophilia Wiki
Jump to navigationJump to search

This is the documentation page for Module:TwitterSnowflake

This is a Lua module to translate snowflakes from platforms such as X (formerly Twitter) and Discord into timestamps. This can be used for automatically generating dates for templates like {{Cite tweet}}.

Usage

There is one required parameter: |id_str=, which must be the snowflake ID of the tweet. For example, 1345021162959503360.

{{#invoke:TwitterSnowflake|snowflakeToDate|id_str=1345021162959503360}} returns January 1, 2021.

To specify the date format returned, use |format=.

{{#invoke:TwitterSnowflake|snowflakeToDate|id_str=1345021162959503360|format=%e %B %Y}} returns 1 January 2021 — useful to specify, especially for use in CS1 citations, in the event that the default date format changes in the future (however unlikely).

Custom epoch

By default, the epoch used is that of Twitter. To specify a different epoch, such as that of Discord (whose value is 1420070400), use |epoch=.

{{#invoke:TwitterSnowflake|snowflakeToDate|id_str=797545051047460888|epoch=1420070400}} returns January 9, 2021.

See also