Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom timezone for built-in timestamp #1073

Merged
merged 5 commits into from
Mar 7, 2020

Conversation

yash-chowdhary
Copy link
Contributor

@yash-chowdhary yash-chowdhary commented Mar 1, 2020

What is the purpose of this pull request? (put "X" next to an item, remove the rest)

• [x] Enhancement to an existing feature

Fixes #1072

What is the rationale for this request?
Allows custom time zones to be used to generate the timestamp. Region-specific websites have a use for this feature, as it doesn't always make sense to refer to UTC/GMT time.

What changes did you make? (Give an overview)

  • Add support for "timezone" and "locale" params in site.json.
  • The 2 params above default to UTC and en-GB.

Is there anything you'd like reviewers to focus on?
N/A

Testing instructions:

  1. Add the following to docs/site.json -
    {
    ...
    "timeZone": "Asia/Singapore",
    "locale": "en-US",
    ...
    }
  2. Scroll down and observe the footer. It should show the local Singapore time in the format -
    "<Day (short)>, <Month (short)> <Date>, <Year (long)>, <Time> <AM/PM> <Time Zone>"
    e.g. "Generated by MarkBind 2.11.0 on Sun, Mar 1, 2020, 10:14:15 PM GMT+8"

Proposed commit message: (wrap lines at 72 characters)
Support custom timezones for built-in timestamp variable

@yash-chowdhary yash-chowdhary changed the title [WIP] Custom timezone for built-in timestamp Custom timezone for built-in timestamp Mar 1, 2020
<code>{<span></span>{ timestamp }}</code> is the time stamp (in UTC) that indicates when the page was generated.
<code>{<span></span>{ timestamp }}</code> is the time stamp that indicates when the page was generated.

You can set the time zone and locale in `site.json` like so -
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be moved to the site configuration page instead like the other options?
I'm personally not so familiar with the possible options for each field; Perhaps the format/standard being used here could be stated as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. It makes more sense for it to be in the configuration page.
I'll link the possible options for both and explain the date and time format.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, following the example of the enableSearch parameter, could we reference the variables.mbdf in siteConfiguration.md to explain the timeZone and locale parameters?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good as well

...
}
```
Compiled in the following gists are lists of possible [time zone](https://gist.github.com/yash-chowdhary/136df3f6721f2fd1d5ea46b14f7c531c) and [locale](https://gist.github.com/yash-chowdhary/674654bdd977b063de008c1b3655a515) options.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm why not add it into the docs itself?
Perhaps a minimal panel or link leading to a new page in the docs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it in a minimal panel 👍


<panel type="minimal" header="Locale Options">
<include src="pages/locales.md" />
</panel>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one last nit: Maybe add a <br> after this as its a little tight

@yamgent yamgent merged commit 4ea52c2 into MarkBind:master Mar 7, 2020
@yamgent yamgent added this to the v2.11.1 milestone Mar 7, 2020
@yamgent yamgent added the pr.Enhancement 📈 Enhancement to an existing feature label Mar 7, 2020
Tejas2805 added a commit to Tejas2805/markbind that referenced this pull request Mar 7, 2020
…nvert-to-code-block

* 'master' of https://github.com/MarkBind/markbind:
  Allow changing parameter properties (MarkBind#1075)
  Custom timezone for built-in timestamp (MarkBind#1073)
  Fix reload inconsistency when updating frontmatter (MarkBind#1068)
  Implement an api to ignore content in certain tags (MarkBind#1047)
  Enable AppVeyor CI (MarkBind#1040)
  Add heading and line highlighting to code blocks (MarkBind#1034)
  Add dividers and fix bug in siteNav (MarkBind#1063)
  Fixed navbar no longer covers modals (MarkBind#1070)
  Add copy code-block plugin (MarkBind#1043)
  Render plugins on dynamic resources (MarkBind#1051)
  Documentation for Implement no-* attributes for <box>  (MarkBind#1042)
  Migrate to bootstrap-vue popovers (MarkBind#1033)
  Refactor preprocess and url processing functions (MarkBind#1026)
  Add pageNav to Using Plugins Page (MarkBind#1062)

# Conflicts:
#	docs/userGuide/syntax/siteNavigationMenus.mbdf
Tejas2805 added a commit to Tejas2805/markbind that referenced this pull request Mar 9, 2020
* 'master' of https://github.com/MarkBind/markbind:
  2.12.0
  Update outdated test files
  Update vue-strap version to v2.0.1-markbind.37
  Fix refactor to processDynamicResources (MarkBind#1092)
  Implement lazy page building for markbind serve (MarkBind#1038)
  Add warnings for conflicting/deprecated component attribs (MarkBind#1057)
  Allow changing parameter properties (MarkBind#1075)
  Custom timezone for built-in timestamp (MarkBind#1073)
  Fix reload inconsistency when updating frontmatter (MarkBind#1068)
  Implement an api to ignore content in certain tags (MarkBind#1047)
  Enable AppVeyor CI (MarkBind#1040)
  Add heading and line highlighting to code blocks (MarkBind#1034)
  Add dividers and fix bug in siteNav (MarkBind#1063)
  Fixed navbar no longer covers modals (MarkBind#1070)
  Add copy code-block plugin (MarkBind#1043)
  Render plugins on dynamic resources (MarkBind#1051)
  Documentation for Implement no-* attributes for <box>  (MarkBind#1042)
  Migrate to bootstrap-vue popovers (MarkBind#1033)
  Refactor preprocess and url processing functions (MarkBind#1026)
  Add pageNav to Using Plugins Page (MarkBind#1062)
@damithc
Copy link
Contributor

damithc commented Mar 9, 2020

Works in production. Nice work @yash-chowdhary and reviewers. 👍

marvinchin pushed a commit that referenced this pull request Apr 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr.Enhancement 📈 Enhancement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Built-in Variable timestamp: support specifying a time zone
4 participants