LibDailyResetTime

Developer Reference

Table of Contents

  1. Getting Started
  2. Functions

Getting Started

First, add LibDailyResetTime (LDRT) as a dependency in your addon's manifest:

## DependsOn: LibDailyResetTime

The library can be accessed via the LibDailyResetTime global variable, and it is recommended that you localize it for usage; for example:

local LDRT = LibDailyResetTime

Functions

Get the number of seconds until the next daily reset:

LDRT.GetSecondsUntilNextDailyReset( )

Get the Unix-style timestamp of the next or previous daily reset:

LDRT.GetDailyResetTime( previous )

previous is an optional boolean parameter; if true is passed, the function will return the timestamp of the previous reset (i.e., the start of the current server date).

Returns the timestamp of the next (or previous) daily reset, as a Unix-style (epoch) timestamp.

Get the year, month, and day of the current server date:

LDRT.GetCurrentServerDate( )

Returns the integer year, month, and day representing the current server date.

Note: The server date is aligned with the server's daily reset time and is completely agnostic to local time zones. For example, let's say you are in New York, it is currently 5 in the morning on August 21, 2024, and you are requesting the server date for the NA server. The local time is 2024-08-21 0500 EDT, and the universal time is 2024-08-21 0900 UTC. But the library will report that the server date is 2024-08-20, because the new "day", as far as dailies are concerned, does not start until an hour later at 1000 UTC.

Registers a function to be called when a daily reset happens:

LDRT.RegisterForCallback( name, callback )

name is a unique identifier string.

callback is a function; if this parameter is omitted (nil), the registration associated with name is removed.